EliJDonahue
7/11/2017 - 6:30 PM

Demonstrates the Aras Best Practice of using the select attribute to retrieve only the name property of the related item.

Demonstrates the Aras Best Practice of using the select attribute to retrieve only the name property of the related item.

Item workflow = this.newItem("Workflow","get");
// use the select attribute to retrieve only the name property of the related item
workflow.setAttribute("select", "related_id(name)");
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
// same effect as adding select="name" to the Workflow Process item
// <AML>
//   <Item type="Workflow" action="get" select="related_id(name)">
//     <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>