Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Demonstrates a sub-optimal approach to getting a Workflow item from an Activity
// 1st query
Item workflowProcess = this.newItem("Workflow Process", "get");
Item workflowProcessActivity = workflowProcess.createRelationship("Workflow Process Activity", "get");
Item activity = workflowProcessActivity.createRelatedItem("Activity", "get");
activity.setID('activityId');
workflowProcess = workflowProcess.apply();
String workflowProcessId = workflowProcess.getID();
// 2nd query
Item workflow = this.newItem("Workflow", "get");
workflowProcess = workflow.createRelatedItem("Workflow Process", "get");
workflowProcess.setID(workflowProcessId);
workflow = workflow.apply();
// generates two AML queries
// 1st query
// <AML>
// <Item type="Workflow Process" action="get">
// <Relationships>
// <Item type="Workflow Process Activity" action="get">
// <related_id>
// <Item type="Activity" action="get" id="activityId"/>
// </related_id>
// </Item>
// </Relationships>
// </Item>
// </AML>
//
// 2nd query
// <AML>
// <Item type="Workflow" action="get">
// <related_id>
// <Item type="Workflow Process" action="get" id="workflowProcessId" />
// </related_id>
// </Item>
// </AML>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment