Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Hi,
In a workflow I am attempting to create a Change Task for every changeable on a change notice automatically.
So far I can create the individual change tasks with one changeable each, but I can only get it to be associated under "Resulting Objects" not "Affected Objects" - see below.
The code I am using for the creation and association is as follows:
while (qr.hasMoreElements()) {
wt.vc.Versioned obj = (wt.vc.Versioned) qr.nextElement();
vr.addElement((wt.change2.Changeable2)obj);
wt.change2.WTChangeActivity2 ca = wt.change2.WTChangeActivity2.newWTChangeActivity2();
ca.setName("Test " + i);
ca.setOrganization(org);
ca.setContainer(cont);
ca = (wt.change2.WTChangeActivity2) wt.change2.ChangeHelper2.service.saveChangeActivity(cn, ca);
wt.change2.ChangeHelper2.service.storeAssociations(wt.change2.ChangeRecord2.class, ca, vr);
vr.clear();
i = i + 1;
}
Where:
qr - all of the changeables attached to the change notice by the user.
cn - the change notice.
ca - the change activity.
vr - vector containing the changeables.
Can someone please help with this?
I am using PDMLINK 9.1.
Regards,
Toby
Solved! Go to Solution.
Try this link class
wt.change2.AffectedActivityData
Why would you create individual Change Tasks for each changeable object?
Hi Toby,
I know this thread is quite old, but it seems the only one I can find that refers to what I am trying to do. I want to programmatically link the chnage notice to several existing parts as affected objects. Whenever I use something like
ChangeHelper2.service.storeAssociations(wt.change2.IncludedIn2.class,chgnotice, links); |
I get an error similar to
Unable to look up the delegate to persist the links for the class class wt.change2.IncludedIn2 and the object wt.change2.WTChangeOrder2
I have tried to use
wt.change2.AffectedActivityData
as per the suggestion but I'm not sure how it works and there is almost no documentation on how to use it (which I find it the case with almost all the code). If you did get this working could you possibly post a bit of sample code to help me out and have it available for others.
Thanks
Ben