Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Hi all,
I’m working on a Windchill 10.1 M030 system. I'm working with the Variance (wt.change2.WTVariance) object (waivers and deviations) and trying to get the objects that are on the Affected Objects table. Does anyone have the transition code that will return a query result with these objects? Any help is much appreciated.
Mike
Solved! Go to Solution.
OK, With a little help from David Graham with the queryresult, I have the answer to my question. Also, I'm setting the Resolution Date of the Variance workflow process (I thought I saw someone asking about this but can't find the post). The code is listed below.
/* Workflow code to change the state of the objects in the Affected Objects table of the Variation. */
wt.pom.Transaction trx = new wt.pom.Transaction();
trx.start();
wt.fc.QueryResult affected = wt.change2.ChangeHelper2.service.getChangeables((wt.change2.ChangeIssue) primaryBusinessObject);
while(affected.hasMoreElements()) {
wt.fc.WTObject obj = (wt.fc.WTObject)affected.nextElement();
java.lang.String type = wt.type.TypedUtilityServiceHelper.service.getExternalTypeIdentifier(obj);
if (type.equals("WCTYPE|wt.doc.WTDocument|com.YourDomain.WTDocumentSoftType")) {
wt.fc.Persistable persistable = (wt.fc.Persistable) obj;
if(persistable instanceof wt.lifecycle.LifeCycleManaged) {
wt.lifecycle.LifeCycleManaged lcManaged = (wt.lifecycle.LifeCycleManaged) persistable;
wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(lcManaged, wt.lifecycle.State.toState("PRODUCTION"));
}
}
}
trx.commit();
/* Workflow code to set the Resolution Date of the Variance workflow process */
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setPRResolutionDate((wt.change2.ChangeIssue) primaryBusinessObject);
OK, With a little help from David Graham with the queryresult, I have the answer to my question. Also, I'm setting the Resolution Date of the Variance workflow process (I thought I saw someone asking about this but can't find the post). The code is listed below.
/* Workflow code to change the state of the objects in the Affected Objects table of the Variation. */
wt.pom.Transaction trx = new wt.pom.Transaction();
trx.start();
wt.fc.QueryResult affected = wt.change2.ChangeHelper2.service.getChangeables((wt.change2.ChangeIssue) primaryBusinessObject);
while(affected.hasMoreElements()) {
wt.fc.WTObject obj = (wt.fc.WTObject)affected.nextElement();
java.lang.String type = wt.type.TypedUtilityServiceHelper.service.getExternalTypeIdentifier(obj);
if (type.equals("WCTYPE|wt.doc.WTDocument|com.YourDomain.WTDocumentSoftType")) {
wt.fc.Persistable persistable = (wt.fc.Persistable) obj;
if(persistable instanceof wt.lifecycle.LifeCycleManaged) {
wt.lifecycle.LifeCycleManaged lcManaged = (wt.lifecycle.LifeCycleManaged) persistable;
wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(lcManaged, wt.lifecycle.State.toState("PRODUCTION"));
}
}
}
trx.commit();
/* Workflow code to set the Resolution Date of the Variance workflow process */
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setPRResolutionDate((wt.change2.ChangeIssue) primaryBusinessObject);