Skip to main content
10-Marble
September 10, 2012
Question

Get Lifecycle State

  • September 10, 2012
  • 5 replies
  • 1609 views

In one of my workflows I'm setting the lifecycle state of an object. I've already done some validation that the object's lifecycle template had the target state in it.


I only want to set the state, if the object is not at that target state. Does anybody have a snippet to show me how to get the current state? I'm not seeing what I need in the javadoc, but i'm probably looking in the wrong place.


Thanks,
Steve D.

5 replies

20-Turquoise
September 10, 2012
On 09/10/12 17:16, Stephen Drzewiczewski wrote:
>
> In one of my workflows I'm setting the lifecycle state of an object. I've already done some validation that the object's lifecycle template had the target state in it.
>
> I only want to set the state, if the object is not at that target state. Does anybody have a snippet to show me how to get the current state?
>

For an epmDocument:
epmDocument epmDoc;
String state = epmDoc.getLifeCycleState().toString();

> I'm not seeing what I need in the javadoc, but i'm probably looking in the wrong place.
>
> Thanks,
> Steve D.
>
>
> ----------


--
------------------------------------------------------------------------
Randy Jones
Systems Administrator
Great Plains Mfg., Inc.
1525 E North St
PO Box 5060
Salina, KS USA 67401
email: -
Phone: 785-823-3276
   Fax: 785-667-2695
------------------------------------------------------------------------

10-Marble
September 10, 2012
Thanks, it was too simple... 😞
1-Visitor
September 11, 2012

Steve,


Try this. It should be bomb-proof andwill work for any object type



if (<your object=" here="> instanceof wt.lifecycle.LifeCycleManaged) {
String currentState = ((wt.lifecycle.LifeCycleManaged) <your object=" here=">).getState().toString();
}



FYI You don't have to cast your object to LifeCycleManaged in the second line. If it's an instance on LifeCycleManaged it can already do anything a LifeCycleManaged object can do. I added the cast only for clarity.


Hope this helps


Dave



In Reply to Stephen Drzewiczewski:



In one of my workflows I'm setting the lifecycle state of an object. I've already done some validation that the object's lifecycle template had the target state in it.


I only want to set the state, if the object is not at that target state. Does anybody have a snippet to show me how to get the current state? I'm not seeing what I need in the javadoc, but i'm probably looking in the wrong place.


Thanks,
Steve D.


1-Visitor
September 12, 2012
Steve,

It's the getState() method on the objects themselves (WTPart, WTDocument).

Thanks,
Jason Schrader
1-Visitor
September 12, 2012
Got to look at the latest message in the thread. Sorry for the repeat. 🙂

Thanks,
Jason Schrader