Skip to main content
6-Contributor
September 29, 2021
Question

Dynamically Assign a Task to a Group Based on Workflow Variable

  • September 29, 2021
  • 2 replies
  • 2672 views

Hello,

I am trying to assign one of my tasks to a group (not a role or an individual) based on a variable defined earlier on in the process. For example:

 

If workflowVar = A, assign group A to the task

if workflowVar = B, assign group B to the task

if workflowVar = C, assign group C to the task

etc.

 

I see that there is functionality in Windchill to assign a task to a variable, but I have not found any documents to tell me how to use that functionality. How could I make that variable the group I need? Is there a way to GET a cluster of groups and make the variable the group that I need for the task?

 

Thanks.

 

 

2 replies

16-Pearl
September 29, 2021

Hi @JacobH

Perhaps you could create three tasks, the task participant is group A,B or C. Then create a ‘manual exclusive’ condition to route the workflow to the the right task/group depending on your variable.

 

 

JacobH6-ContributorAuthor
6-Contributor
September 29, 2021

@rhart Thank you for your reply.

 

Unfortunately this would not work. I would be creating 15+ more tasks on the workflow. Using the manual exclusive condition to route would also defeat the purpose of automation in this process. I am trying to remove "set up participants" or other tasks as much as possible, so having a way to assign this task automatically is my goal. 

JacobH6-ContributorAuthor
6-Contributor
September 30, 2021

Alternatively, adding a group to a role automatically using code would solve my problem as well: 

 

If workflowVar = A, add group A to roleA

if workflowVar = B, add group B to roleA

if workflowVar = C, add group C to roleA

 

Thank you,

Jacob

17-Peridot
October 1, 2021

Jacob,

 

I'd recommend using expression code to add the Group to the role.  There is sufficient helpers to get the Principals from the Group and Assign them to the Role for the PBO.  (Along the lines of using wt.group or organizationservices to get members and then using the wt.team helper class to add the principals to that role wt.team.TeamHelper.service.addRolePrincipalMap)

JacobH6-ContributorAuthor
6-Contributor
October 5, 2021

Jeff,

 

Thank you, this gives me a few key words to look for. I'm just trying to come up with the code to do this. First, to GET a group, then to ASSIGN that group to a role.