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

Dynamically Assign a Task to a Group Based on Workflow Variable

JacobH
5-Regular Member

Dynamically Assign a Task to a Group Based on Workflow Variable

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.

 

 

5 REPLIES 5
rhart
12-Amethyst
(To:JacobH)

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.

 

 

JacobH
5-Regular Member
(To:rhart)

@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. 

JacobH
5-Regular Member
(To:JacobH)

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

JeffZemsky
17-Peridot
(To:JacobH)

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)

JacobH
5-Regular Member
(To:JeffZemsky)

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. 

Announcements