Skip to main content
6-Contributor
Oct 5, 2026 4:06 AM UTC
Question

Auto-completing other managers' tasks when one of them completes theirs (one process per WTUser)

Hi all,

We're on Windchill 13.0 and I'm building a Role permission review workflow. For every Product, Library and Project, each member of the Product/Library/Project Manager role has to confirm that the permissions are correct. The task has only the standard Complete Task button, no reject and no custom routing. Every manager should manually review their respective container’s role and add/remove users and groups accordingly.

Right now an Execute Expression robot loops over all containers, reads the members of the role group (Product/Library/Project Manager role), and for each WTUser starts a separate process from a shared task template. It sets assignedUser (a WTUser variable) and primaryBusinessObject, and every process from the same run gets the same batchId. It works fine. Everyone gets their own task with a link to the container's Team page.

The goal is that once any one of the managers completes their task, the tasks of all the other managers of that container are completed automatically. Right now they stay open and eventually send overdue reminders for something that's already been handled.

I'd like to keep one process per individual user, so assigning a group to one shared task isn't what I'm after. What I'm trying to find out:

  1. When one task is completed, what's the best way to resolve the sibling processes (same primaryBusinessObject and batchId) so their tasks are completed too? Querying all WfProcess objects and checking the context feels too heavy for a few hundred containers.
  2. Should I complete their WorkItems or terminate their processes, and which API is the right one? I want the pending reminders to stop and the history to look sensible, not as if the user did the work.
  3. Where would you put this logic, in an expression robot after the activity or on the Complete transition?
  4. Has anyone handled two managers clicking Complete at nearly the same moment?

Sample code or a better design would be great. Thanks!

3 replies

18-Opal
Oct 5, 2026 6:23 AM UTC

Hi ​@WAP_Engine,

I would suggest redesigning the overall process. It would be better to use a context based workflow approach, which would minimize the need for customization.
The workflow can be triggered separately for each context based on the object creation context. This will create a task for the respective Context Manager based on the PBO context. Once any one of the Context Managers completes the task, the workflow can proceed to the next node.

Translate
HelesicPetr
22-Sapphire II
Oct 14, 2026 9:02 AM UTC

Hello ​@WAP_Engine 

It is good idea to work with workflows and small peace of code in the expression robot.

You can use complete event or expression robot . It is up to you what is more suitable for your process.   

  1. I would search for the WFProcesses based on the primaryBusinessObject and ID. You do not have to query all wfprocesses. search WFProcess api: 
    QueryResult runningProcesses = WfEngineHelper.service.getAssociatedProcesses(primaryBusinessObject, WfState.OPEN_RUNNING, null)

     

  2. I would complete the work items with additional information that the task has been completed by automatization api to complete WFProcess 
    WfProcess wtcm = (WfProcess) resWTProces.nextElement();
    WfExecutionObject exeObj = WfEngineHelper.service.changeState(wtcm, WfTransition.COMPLETE);
     
  3. It is up to you what you need. You can write the code to the complete task transition in the task or you can use expression robot after the task is completed. If you need to check some rules and retry the completed task, you can manage it in the workflow with standard loop logic or you can use the Competition transition. 
  4. By my experience there is no issue . If two users click the complete button in same time, there is always only one winner :D.   

PetrH

Translate
joe_morton
19-Tanzanite
Oct 29, 2026 6:42 PM UTC

I agree with the earlier commenters - I may be missing some of the reasoning, but this seems overly complicated to me. Just assign the task to the Product/Library/Project Manager role, and set it so that “any” can complete it. That’s normal, out-of-the-box functionality, and you don’t have to manage or maintain custom code going forward.

Translate