cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Translate the entire conversation x

How to Update the Lifecycle State of Resulting objects from a Change Notice

iwebb
2-Explorer

How to Update the Lifecycle State of Resulting objects from a Change Notice

I am attempting to set the Lifecycle State of the Resulting (Document) Objects from within the Change Notice Workflow, the following code fails a Syntax Check (at LINE 1 below). Any ideas how to correct this and get this working ?

//Find Resulting Objects and set State to Under Review

wt.change2.ChangeOrder2 pbo = (wt.change2.ChangeOrder2) primaryBusinessObject;
wt.fc.QueryResult activities = wt.change2.ChangeHelper2.service.getChangeActivities(pbo);
while (activities.hasMoreElements()) {
wt.change2.ChangeActivity2 activity = (wt.change2.ChangeActivity2) activities.nextElement();
System.out.println("IDW 1 task " + activity.getDisplayIdentity().getLocalizedMessage(java.util.Locale.ENGLISH));
wt.fc.QueryResult resulting = wt.change2.ChangeHelper2.service.getChangeablesAfter(activity);
while (resulting.hasMoreElements()) {
// set State for each Document
wt.fc.Persistable persistable = (wt.fc.Persistable)resulting.nextElement();
if (persistable instanceof wt.doc.WTDocument){
wt.doc.WTDocument docAff = (wt.doc.WTDocument)persistable;
State state = toState("UNDERREVIEW"); //LINE 1

docAff.setLifeCycleState(state);

wt.doc.WTDocumentMaster dmaster = (wt.doc.WTDocumentMaster) docAff.getMaster();
String affName = dmaster.getName();
System.out.println("IDW 2 Affected Doc: " + affName);
}
}
}

3 REPLIES 3
dwilliams
12-Amethyst
(To:iwebb)

Try the following:

wt.fc.QueryResult resulting = wt.change2.ChangeHelper2.service.getChangeablesAfter( (wt.change2.ChangeOrderIfc) primaryBusinessObject);
while(resulting.hasMoreElements())
{
wt.fc.Persistable persistable = (wt.fc.Persistable)resulting.nextElement();
if (persistable instanceof wt.doc.WTDocument)
{
wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(((wt.lifecycle.LifeCycleManaged)resulting.nextElement()),wt.lifecycle.State.toState("UNDERREVIEW"),true);
wt.doc.WTDocument docAff = (wt.doc.WTDocument)persistable;
wt.doc.WTDocumentMaster dmaster = (wt.doc.WTDocumentMaster) docAff.getMaster();
String affName = dmaster.getName();
System.out.println("IDW 2 Affected Doc: " + affName);
}
}

Thanks,
Dax
tbusch
1-Visitor
(To:iwebb)

State state = toState("UNDERREVIEW");

Should be

State state = State.toState("UNDERREVIEW");

-Thomas R. Busch
Sr. Software Developer
Stryker Instruments
(269) 323-7700 x4014
tom.busch@stryker.com<">mailto:tom.busch@stryker.com>
tbusch
1-Visitor
(To:iwebb)

Ahhh by the way you might have to fully qualify it:

wt.lifecycle.State state = wt.lifecycle.State.toState("UNDERREVIEW");

-Thomas R. Busch
Sr. Software Developer
Stryker Instruments
(269) 323-7700 x4014
tom.busch@stryker.com<">mailto:tom.busch@stryker.com>
Announcements
Top Tags