How to get the table id?

I want to catch the id to select some information (table is Mi_Issue_Todolist). But I can't get the real id Here is my script, please help me to resolve the problem, thank you~ Innovator inn = this.getInnovator(); string ContextId = this.getID(); Item itemQ = inn.newItem("MI_ISSUE_TODOLIST","get"); itemQ.setAttribute("select","classification"); itemQ.setProperty("id", ContextId) or Innovator inn = this.getInnovator(); Item itemQ = inn.newItem("MI_ISSUE_TODOLIST","get"); itemQ.setAttribute("select","classification"); itemQ.setProperty("id", itemQ.getAttribute("id"));   If I put the id to the scipt, and then it's ok to run: Innovator inn = this.getInnovator(); Item itemQ = inn.newItem("MI_ISSUE_TODOLIST","get"); itemQ.setAttribute("select","classification"); itemQ.setProperty("id", "34A134682BB249BC8AA64BED628AAAAA");
  • Hello, Could you let us know where this method is being called from? (e.g. an onBeforeAdd Server Event, an Action, etc.) Chris
    Christopher Gillis Aras Labs Software Engineer
  • Hello, It's in the Workflow, the method is On Vote! The demand is when user vote something and press OK button, system can called the method and catch the id to know if some column is null... Thank you for your help.
  • Hello, In an OnVote event the item stored in this is the Activity that is being voted on, not the work item of the workflow. To get the work item, you can use code like below to look up the item attached to the Workflow being voted on.
    Innovator inn = this.getInnovator();
    // In order to get the item this workflow is attached to, we first need to get the workflow
    Item parentWorkflow = inn.newItem("Workflow", "get");
    parentWorkflow.setAttribute("select", "source_id,source_type");
    Item workflowProcess = parentWorkflow.createRelatedItem("Workflow Process", "get");
    Item workflowProcessActivity = workflowProcess.createRelationship("Workflow Process Activity", "get");
    workflowProcessActivity.setProperty("related_id", this.getID());
    parentWorkflow = parentWorkflow.apply();
    // Now get the Item that this workflow is attached to
    string sourceITName = parentWorkflow.getPropertyAttribute("source_type", "keyed_name", "");
    Item workItem = inn.newItem(sourceITName, "get");
    workItem.setAttribute("id", parentWorkflow.getProperty("source_id", ""));
    workItem = workItem.apply();
    Chris
    Christopher Gillis Aras Labs Software Engineer
  • Hello, In an OnVote event the item stored in this is the Activity that is being voted on, not the work item of the workflow. To get the work item, you can use code like below to look up the item attached to the Workflow being voted on.
    Innovator inn = this.getInnovator();
    // In order to get the item this workflow is attached to, we first need to get the workflow
    Item parentWorkflow = inn.newItem("Workflow", "get");
    parentWorkflow.setAttribute("select", "source_id,source_type");
    Item workflowProcess = parentWorkflow.createRelatedItem("Workflow Process", "get");
    Item workflowProcessActivity = workflowProcess.createRelationship("Workflow Process Activity", "get");
    workflowProcessActivity.setProperty("related_id", this.getID());
    parentWorkflow = parentWorkflow.apply();
    // Now get the Item that this workflow is attached to
    string sourceITName = parentWorkflow.getPropertyAttribute("source_type", "keyed_name", "");
    Item workItem = inn.newItem(sourceITName, "get");
    workItem.setAttribute("id", parentWorkflow.getProperty("source_id", ""));
    workItem = workItem.apply();
    Chris
    Christopher Gillis Aras Labs Software Engineer