Improve code for handling of poly items
Closed this issue · 3 comments
Hi,
one code part in Convert ECR to ECN is used for adding an additonal relationship in the ECN that links back to the ECR.
The current version works well for regular Items. But in may case, both Express ECO and ECR can result into an ECN. To avoid to much additional tabs in the ECN, I use a PolyItem for storing the Change Items.
When using PolyItems, an additional "Select Poly Source" Window will appear after triggering the Convert to ECN Action button. This window can be avoided with the following modification in the code:
// Add a relationship back to the ECR
var typeID = top.aras.getItemFromServerByName("RelationshipType","ECN ECR","id").node.getAttribute("id");
// var ecrRel = top.aras.newRelationship(typeID,ecnItem); <- previous version
// top.aras.setItemProperty(ecrRel,"related_id",this.node); <- previous version
var ecrRel = aras.newRelationship(typeID,ecnItem,false,this,this.node); // <- better variant for handling poly items, avoids additional search dialog
It doesn´t seem to conflict with the regular ECR / ECN relationship settings. So this is maybe a good improvment to the project.
Best regards,
Angela
Hi Angela,
This sounds reasonable. If you want to submit a pull request, I'll test it out and merge it.
Eli
Hi Eli,
Stuff that turned out to be useful, deserves to stay up-to-date. I submitted a pull request for this change.
I also removed the top references. I didn´t remove the clientList and the ecrItem that I mentioned in another issue.
Angela
Merged in PR #4.