Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Try this code:
if(((wt.lifecycle.LifeCycleManaged) obj).getLifeCycleState().equals(wt.lifecycle.State.DEFINITION_REQUIRED))
result="Assign Task";
Remember to remove the semicolon after your if-statement. Otherwise it does nothing...
In Reply to Michael Kramer:
I'm not a java guru....but I'm working on some workflow stuff and I'm trying to set up a synchronization robot. I've taken the workflow training and there's an example of creating a robot. The robot in the example sends a notification when an object has a change in its state....great....almost what I want but not quite. I'm looking for a way to send a notification when the object has a very specific state (like "DEFINITION_REQUIRED"). Does anyone have a good example of the syntax to do this?
I'm winging it a bit here but.....
I've tried:if (((wt.lifecycle.LifeCycleManaged)primaryBusinessObject).getLifeCycleState()==DEFINITION_REQUIRED);result="Assign Task";
and I've tried:if (((wt.lifecycle.LifeCycleManaged)primaryBusinessObject).getLifeCycleState()==wt.lifecycle.State.DEFINITION_REQUIRED);result="Assign Task";
But when I select the CHECK SYNTAX button, I receive the message below which means nothing to me.....I just stare it hoping that I'll see the hidden message in there like one of those 3-D pictures.....and Yes....DEFINITION_REQUIRED is a valid life cycle state already.
Checking Syntax...D:\ptc\Windchill\temp\WfExpression35839124.java:30: cannot find symbolsymbol : variable DEFINITION_REQUIREDlocation: class wt.lifecycle.Stateif (((wt.lifecycle.LifeCycleManaged)primaryBusinessObject).getLifeCycleState()==wt.lifecycle.State.DEFINITION_REQUIRED); ^D:\ptc\Windchill\temp\WfExpression35839124.java:65: cannot find symbolsymbol : variable DEFINITION_REQUIREDlocation: class wt.workflow.expr.WfExpression35839124if (((wt.lifecycle.LifeCycleManaged)primaryBusinessObject).getLifeCycleState()==DEFINITION_REQUIRED); ^2 errorsSyntax check complete.
Mike -
try this:
wt.lifecycle.State.toState("DEFINITION_REQUIRED")
wt.lifecycle.State.DEFINITION_REQUIRED does not exist.
br
Frederik