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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

promoting a Object to Released state the previous released iteration is not autoset to Obsolete

mbrockman
10-Marble

promoting a Object to Released state the previous released iteration is not autoset to Obsolete

Hi, I want to automatically set the previous "Released" document to "Obsolete" when a newer revision is promoted to "Released".  This is to avoid having older revisions still having their life cycle state remaining "Released".  I have this code from CS153831 which is just what I think will do the trick, but cannot correctly add it to the workflow.  I tried adding it to the approval transitions to no avail.
 
Thanks, Mark
 
 
wt.doc.WTDocument predecessor = (wt.doc.WTDocument) wt.vc.VersionControlHelper.service.predecessorOf((wt.doc.WTDocument) primaryBusinessObject);
if (predecessor != null)
predecessor=(wt.doc.WTDocument) wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(predecessor, wt.lifecycle.State.toState("Obsolete") );
2 REPLIES 2

The PrimaryBusinessObject for this workflow is likely a Change Request, not a WTDocument, so the code does not act on the document.  

Need the code to "navigate" from the change object to the resulting data to the resulting data's predecessor (previous Revision's last Iteration), and then set the state of it.  Or, from change object to Affected data.

For understanding, might want to:

- create a workflow template with just this

- initiate the workflow via admin UI and tie to a WTDocument directly (one with a previous Rev)

pmöllberg
4-Participant
(To:mbrockman)

Hi

Did you get this to work? I'm after the exact same function.

 

Thanks

 

Pär

Announcements

Top Tags