Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
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.
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.