Skip to main content
1-Visitor
October 28, 2013
Solved

Reassign Life cycles within a workflow

  • October 28, 2013
  • 1 reply
  • 9258 views

Hi,

I have a workflow that requires that the life cycle of an object be reassigned in some instances. Currently I have a task that gets sent to the relevant user notifying them that they must reassing the life cycle of the object. Is there a way that I could use a robot in the flow that when a particular routing is fired then the pbo's lifecycle is reassigned?

Thanks.

Best answer by satre-2

From screen shot it seems like you want to restart same workflow process i.e. set the state of POB to open so workflow will be trigger, in that case you can use set state robot to change state to Open (See screen shot)

screen1.jpg

If you want to reassign any other lifecycle then you can add below line

  1. wt.lifecycle.LifeCycleHelper.service.reassign(primaryBusinessObject, LifeCycleHelper.service.getLifeCycleTemplateReference(" UR LIFECYCLE Name "));

screen2.jpg

You can read the documentation related to API from below file

[Windchill_Home]/codebase/wt/clients/library/api/wt/lifecycle/LifeCycleService.html

Below are few method for reassigning lifecycle

  1. 1. LifeCycleManaged reassign(LifeCycleManaged object, LifeCycleTemplateReference lctRef, WTContainerRef context) throws WTException, LifeCycleException

Parameters:

object - the LifeCycleManaged object that should be assigned to a new life cycle

lctRef - a reference to a LifeCycleTemplate, the LifeCycleTemplate that the object should be reassigned to

context - the container where the objects associated workflow processes will be created

  1. 2. LifeCycleManaged reassign(LifeCycleManaged object, LifeCycleTemplateReference lctRef, WTContainerRef context, String comments) throws WTException, LifeCycleException

Parameters:

object - the LifeCycleManaged object that should be assigned to a new life cycle

lctRef - a reference to a LifeCycleTemplate, the LifeCycleTemplate that the object should be reassigned to

context - the container where the objects associated workflow processes will be created

comments - Notes or comments for the lifecycle operation. Can be null.

  1. 3. LifeCycleManaged reassign(LifeCycleManaged object, LifeCycleTemplateReference lctRef) throws WTException, LifeCycleException

Parameters:

object - the LifeCycleManaged object that should be assigned to a new life cycle

lctRef - a reference to a LifeCycleTemplate, the LifeCycleTemplate that the object should be reassigned to

  1. 4. reassign(WTList list, wt.lifecycle.LifeCycleTemplateReference lctRef, WTContainerRef context, State state)

Parameters:

list - the WTList of LifeCycleManaged objects that should be assigned to a new life cycle

lctRef - a reference to a LifeCycleTemplate, the LifeCycleTemplate that the object should be reassigned to

context - The container which the object resides in.

state - The state the objects in the lifecycle should be assigned when reassigned to the lifecycle.

Also make sure that end flag will have only one input otherwise workflow process will keep running ( See screenshot ).

Hope this helps !!!

Thanks,

Shreyas

1 reply

1-Visitor
October 28, 2013

Use wt.lifecycle.LifeCycleHelper.service.reassign(WTDoc, newLFRef);

This will reassign new LC

Regards

Mani.


1-Visitor
October 28, 2013

Hi,

@Igor, thanks but, i don't want to set the state, I want to reassign the LC. meaning all nodes are reset. Currently this can be done via the actions menu on a WTObject that is associated to a LC.

@ Mani, please explain the expression a bit for me. I entered it into an expression robot and I get the following 2 errors. I gather I need to create variable in my WF. What I have is subprocesses running based on the manufacturing plant selected. When the subs are done they leave the pbo in one of two states. Namely; Reopened or Completed. Now, I could't add a task to request a user to perform the reassign action, but I would rather have the system control that for obvious reasins of efficiency. Hence I want to reassign the LC and restart the wf automatically.

10-Marble
October 28, 2013

Hi,

you can use Method Robot and set Robot Type as "Set State" - then select Specific State

wf_editor.png

iviewcapture_date_28_10_2013_time_11_18_58.png