Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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