Linking Described-By Documents to a Part Instance Best Practices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Linking Described-By Documents to a Part Instance Best Practices
The below method seems to be working great but I was curious, since it's not documented, if there's a better way to do link described-by documents to a WTProductInstance2.
WTProductInstance2 instance = WTPartHelper.service.littleCreateDocLinks(instance, collection, false);
If you are wondering where I found this, it's being used by PartManagementHelper in the createRelationship() method. This PartManagmentHelper is a class called by some form processors, one in particularly is for the wizard that adds described-by documents to a part instance from the UI. I could use the createRelationship() method, but it's making a couple checks I've already handled so I went straight for the gold.
Thanks,
Chris
Windchill 10.2 M020, CPS15
- Labels:
-
UI (Model-View-Controller)
- Tags:
- group discussion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This should get you there too:
wt.part.WTPartDescribeLink linkToCreate = wt.part.WTPartDescribeLink.newWTPartDescribeLink(part, doc);
PersistenceHelper.manager.save(linkToCreate);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks for the reply Aaron.
Yes what you suggest will link a WTPart but not a wt.part.WTProductInstance2. I previously attempted this same sort of maneuver as shown below.
WTProductInstanceDescribeLink link = WTProductInstanceDescribeLink.newWTProductInstanceDescribeLink(instance, doc);
persistable = PersistenceHelper.manager.save(link);
Doing this I get the WTException,"The object is not a session iteration. You can not modify it." I assume the error has something to do with attempting to modify without locking it and/or getting a workable version of it. The WTProductInstance2 object does not implement Workable so I do not know how to perform a type of "check-out."
