Skip to main content
19-Tanzanite
Nov 2, 2026 2:22 PM UTC
Solved

Workflow Task Routing

In a workflow I am using a Manual Exclusive routing with 4 choices with all participants required. Let's call them A, B, C and D. For choices, A and B, I want to tally them and if B is used once, it sets a variable to XYZ. For choices C and D, I want the task to immediately route to either C or D. Is there code available for the Routing/Tallying Expression to do this?

19-Tanzanite
Nov 4, 2026 1:34 PM UTC

This is actually a twofold answer.

 

For the A, B routing, I had to change from Manual Exclusive to Manual and put in code for routing to any event that has 1 or more votes.

 

For the immediately routing if C or D is chosen, Felco Solutions helped figure it out with a small amount of code that goes in the Optional Condition for Transition: Complete Task.  This will immediately route and it will also close out all tsks for other users.

 

int reworkCount = wt.workflow.work.WfTally.count(
self, "Rework"
);

if (reworkCount >= 1) {
wt.workflow.work.WorkflowHelper.service.completeActivity(
self, "Rework"
);
}

 

1 reply

BrianToussaint19-TanzaniteAuthorAnswer
19-Tanzanite
Nov 4, 2026 1:34 PM UTC

This is actually a twofold answer.

 

For the A, B routing, I had to change from Manual Exclusive to Manual and put in code for routing to any event that has 1 or more votes.

 

For the immediately routing if C or D is chosen, Felco Solutions helped figure it out with a small amount of code that goes in the Optional Condition for Transition: Complete Task.  This will immediately route and it will also close out all tsks for other users.

 

int reworkCount = wt.workflow.work.WfTally.count(
self, "Rework"
);

if (reworkCount >= 1) {
wt.workflow.work.WorkflowHelper.service.completeActivity(
self, "Rework"
);
}

 

Translate