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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Retrieving the Destination State During a Promotion Process

Toby.Pettit
12-Amethyst

Retrieving the Destination State During a Promotion Process

Hi All,

I am trying to make it so that my promotion workflows are effected by the destination state of the promotion - I want different tasks etc if the destination state is Prototype compared to Implementation for example.

I know that I could simple give the user the option of two promotion processes which they can select from depending on what state they are promoting to. However I want to eliminate the chance that they accidently choose the wrong process - since things such as the ERP connector are triggered in different ways depending on the destination state.

I therefore want to put a conditional node into the promotion workflow which directs the workflow based on the destination state - meaning one workflow per state.

Regards,

Toby

ACCEPTED SOLUTION

Accepted Solutions

This is an OTB functionality - you do not have to set up branching in the workflow. Instead, you automatically select the workflow to be used, based on the target state selected by the user (or automatically selected by the system if there is only one possible target state defined in the lifecycle).

Use Promotion Preference Manager. Very carefully read how this works in the on-line help.

Summary:

- You create a workflow process for each target state

- You create a preference entry for each target state, whose value is the name of the workflow process to be used.

Note: A GUI for this was added in 9.0 but it was available via load from file from 8.0 on.

View solution in original post

10 REPLIES 10

Hi Toby,

You can do a branching based upon a lifecycle state. On the Routing ta, create the routing events. Use the following Routing expression:

if(((wt.lifecycle.LifecycleManaged)primaryBusinessObject).getLifecycleState()==wt.lifecycle.State.STATE)

result="Routing Event"

else

result="Other Routing Event"

Thanks

SItanshu

Hi Sitanshu,

Is that branch based on source or destination state? I want to branch based on destination state. I will also be using different promotion processes based on source state but I can use promotion preferences for that.

Regards,

Toby

Will this work for you: LifeCycleHelper.service.getSuccessorState(lcm)

I'm currently working on something else but I shall give it a go in a while.

I can put it in an expression I assume?

Toby

I was about to reply the same. I think LifeCycleHelper.service.getSuccessorState(lcm) should work.

I gave it a go and when I checked the syntax it said the following:

Checking Syntax...

/apps/ptc/Windchill_9.1/Windchill/tmp/WfExpression8831218.java:27: cannot find symbol

symbol : variable lcm

location: class wt.workflow.expr.WfExpression8831218

if(LifeCycleHelper.service.getSuccessorState(lcm).equals (wt.lifecycle.State.CANCELED)) {

^

/apps/ptc/Windchill_9.1/Windchill/tmp/WfExpression8831218.java:27: package LifeCycleHelper does not exist

if(LifeCycleHelper.service.getSuccessorState(lcm).equals (wt.lifecycle.State.CANCELED)) {

^

2 errors

Syntax check complete.

The code that I tried was:

if(LifeCycleHelper.service.getSuccessorState(lcm).equals (wt.lifecycle.State.CANCELED)) {

result="Canceled";

} else {

result="Implementation";

}

Toby

You need to provide the package names for anything outside of java.lang, I think

wt.lifecycle.LifeCycleHelper.service.getSuccessorState((wt.lifecycle.LifeCycleManaged)primaryBusinessObject).

You might also need to check for a null result?

Well that got rid of one of the 2 errors..

Checking Syntax...

/apps/ptc/Windchill_9.1/Windchill/tmp/WfExpression8831422.java:27: package LifeCycleHelper does not exist

if(LifeCycleHelper.service.getSuccessorState((wt.lifecycle.LifeCycleManaged)primaryBusinessObject).equals (wt.lifecycle.State.RELEASED) ) {

^

1 error

Syntax check complete.

if(LifeCycleHelper.service.getSuccessorState((wt.lifecycle.LifeCycleManaged)primaryBusinessObject).equals (wt.lifecycle.State.RELEASED) ) {

result="Released";

} else {

result="Implementation";

}

It also won't let me put any other state than released in the IF. I've tried production, canceled and concept.

(I'll add the try-catch when I get it working)

Toby

This is an OTB functionality - you do not have to set up branching in the workflow. Instead, you automatically select the workflow to be used, based on the target state selected by the user (or automatically selected by the system if there is only one possible target state defined in the lifecycle).

Use Promotion Preference Manager. Very carefully read how this works in the on-line help.

Summary:

- You create a workflow process for each target state

- You create a preference entry for each target state, whose value is the name of the workflow process to be used.

Note: A GUI for this was added in 9.0 but it was available via load from file from 8.0 on.

This is an OTB functionality - you do not have to set up branching in the workflow. Instead, you automatically select the workflow to be used, based on the target state selected by the user (or automatically selected by the system if there is only one possible target state defined in the lifecycle).

Use Promotion Preference Manager. Very carefully read how this works in the on-line help.

Summary:

- You create a workflow process for each target state

- You create a preference entry for each target state, whose value is the name of the workflow process to be used.

Note: A GUI for this was added in 9.0 but it was available via load from file from 8.0 on.

Announcements


Top Tags