Last active
March 19, 2019 20:11
-
-
Save cgillis-aras/c112e17a5c1e4f6201a8f7ff746b6125 to your computer and use it in GitHub Desktop.
Example of a custom action in Aras Innovator
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
Innovator inn = this.getInnovator(); | |
Item partToAdd = this; | |
partToAdd.setAction("add"); | |
string parentPartNumber = this.getAttribute("parent", ""); | |
if (String.IsNullOrEmpty(parentPartNumber)) | |
{ | |
// If no parent is specified, just add the part like normal | |
return partToAdd.apply(); | |
} | |
else | |
{ | |
// If there is a parent, also create a relationship to that parent as part of this add | |
Item relationshipToParent = inn.newItem("Part BOM", "add"); | |
Item parentPart = relationshipToParent.createPropertyItem("source_id", "Part", "get"); | |
parentPart.setProperty("item_number", parentPartNumber); | |
relationshipToParent.setRelatedItem(partToAdd); | |
return relationshipToParent.apply(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment