Last active
July 11, 2017 19:37
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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