Forum Discussion
christopher_gillis
8 years agoCommunity Manager
Hi Leo,
I have written the sample below using the Part Document relationship to show how you can add a new relationship and then open the form of the new related item.
var relshipID = aras.getRelationshipTypeId("Part Document");
var srcItem = aras.getItemById("Part", "579766B0E0914B399016CBFE2BDF531E");
// Create the new related item
var relatedItem = aras.newItem("Document");
// Create the relationship
var temp = aras.newRelationship(relshipID, srcItem, false, this, relatedItem, "Document");
// Show the new related item
aras.uiShowItemEx(relatedItem, 'tab view', false, false);
Please note that this sample is intentionally simplified and does not do things like:
- Ensure the parent item is locked
- Synchronize the data between the related item's form and the row in the parent item's relationship grid