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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

How to use SetState for Promotion Request Objects using Expression Robot of workflow?

maheshkumar
2-Explorer

How to use SetState for Promotion Request Objects using Expression Robot of workflow?

Hi Gurus,

I am using Windchill 11.0 M010, The selected Promotion Request Targets/Objects should move to a Life Cycle Stateusing API,

following APIs tried use,

QueryResult qr = wt.maturity.MaturityHelper.service.getBaselineItems((PromotionNotice pn);

2.       Set state for the Promotion Notice objects:

wt.lifecycle.LifeCycleServerHelper.service.setState(LifeCycleManaged object, State state);


I have the code however i am unable to compile , setState is not recognizing.


Please help me




Thanks & best regards,

Mahesh

4 REPLIES 4

First line has non matching brackets

QueryResult qr = wt.maturity.MaturityHelper.service.getBaselineItems((PromotionNotice pn);


Coming back to your question:


       Set state for the Promotion Notice objects:

wt.lifecycle.LifeCycleServerHelper.service.setState(LifeCycleManaged object, State state);


Modify your code as follows:


java.lang.Object obj;

  wt.lifecycle.State state;

  wt.lifecycle.LifeCycleServerHelper.service.setState((LifeCycleManaged) obj, state);

Hi Rajesh,

Thanks for the reply,

I have validated the same following errors coming,

Checking Syntax...

C:\ptc\Windchill_10.2\Windchill\temp\WfExpression_Administrator.java:41: error: package javalang does not exist

javalang.Object obj;

        ^

C:\ptc\Windchill_10.2\Windchill\temp\WfExpression_Administrator.java:43: error: cannot find symbol

wt.lifecycle.LifeCycleServerHelper.service.setState((LifeCycleManaged) obj, state); 

                                                     ^

  symbol:   class LifeCycleManaged

  location: class WfExpression_Administrator

Note: C:\ptc\Windchill_10.2\Windchill\temp\WfExpression_Administrator.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

2 errors

Syntax check complete.

Your first error in this line is due to a missing "." in the package declaration. You have:

javalang.Object obj;

this needs to be:

java.lang.Object obj;

The second error is due to an incomplete package declaration for the LifeCycleManaged class. You have:

wt.lifecycle.LifeCycleServerHelper.service.setState((LifeCycleManaged) obj, state);

this needs to be:

wt.lifecycle.LifeCycleServerHelper.service.setState((wt.lifecycle.LifeCycleManaged) obj, state);


Hi Zach Sternal,

Thanks for the observations,

I am getting the following error, i would feel that i am unable to define a Proper obj variable. I am new to customization.

Can you please help me out.

Checking Syntax...

C:\ptc\Windchill_10.2\Windchill\temp\WfExpression156153.java:45: error: variable obj might not have been initialized

wt.lifecycle.LifeCycleServerHelper.service.setState((wt.lifecycle.LifeCycleManaged) obj, state); 

                                                                                    ^

C:\ptc\Windchill_10.2\Windchill\temp\WfExpression156153.java:45: error: variable state might not have been initialized

wt.lifecycle.LifeCycleServerHelper.service.setState((wt.lifecycle.LifeCycleManaged) obj, state); 

                                                                                         ^

Note: C:\ptc\Windchill_10.2\Windchill\temp\WfExpression156153.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

2 errors

Syntax check complete.

Thanks in Advance

Best Regards,

Mahesh

Announcements

Top Tags