Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EliJDonahue/e60ee0bff052d1a3902aba33c7e5d466 to your computer and use it in GitHub Desktop.
Save EliJDonahue/e60ee0bff052d1a3902aba33c7e5d466 to your computer and use it in GitHub Desktop.
Demonstrates the Aras Best Practice of using the relationship structure in a single query instead of using multiple queries. This case gets a Workflow item from an Activity using one query.
// single query
Item workflow = this.newItem("Workflow","get");
Item workflowProcess = workflow.createRelatedItem("Workflow Process","get");
Item workflowProcessActivity = workflowProcess.createRelationship("Workflow Process Activity","get");
Item activity = workflowProcessActivity.createRelatedItem("Activity", "get");
activity.setID('activityId');
workflow = workflow.apply();
// generates the following AML query
// <AML>
// <Item type="Workflow" action="get">
// <related_id>
// <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>
// </related_id>
// </Item>
// </AML>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment