Skip to content

Instantly share code, notes, and snippets.

@EliJDonahue
Last active July 11, 2017 19:40
Show Gist options
  • Save EliJDonahue/f0c770113ccb3237c69fb4e83c43601f to your computer and use it in GitHub Desktop.
Save EliJDonahue/f0c770113ccb3237c69fb4e83c43601f to your computer and use it in GitHub Desktop.
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