cancel
Showing results for 
Search instead for 
Did you mean: 

assigning user to a User task

dharamjeet
Confirmed Champ
Confirmed Champ

sample workflow

Above is a workflow diagram, here I have taken a start form with a people field to set assignee for check stock on start event.I'm using a inclusive gateway with condition whether assignee is empty or not, hence if assignee is not empty token moves to the check stock. But the scenario could be like assignee is not provided on start event and in such case I want to set a process variable with " unassigned" and afterwards want to set assignee for check stock, Is there any why I achieve this? 

4 REPLIES 4

gdharley
Elite Collaborator
Elite Collaborator

Maybe I dont understand the specifics, but why cant you add a simple script task after the start event, test for an assignee variable, if not set, then set it to unassigned and then move to the gateway.

Again, maybe I am missing something in the translation.

Greg

Thanks Greg, you are right I can check the assignee variable if it is empty or not, but to perform a user task assignee is must.

In my scenario I need to start a process either by setting the assignee or without it, apart from that I need to maintain a process variable named 'status' as 'unassigned' in case when assignee is not provided which i can do in script task. I'm stuck at the point when no assignee is provided during start event and  I want to move to 'check stock' User task only if assignee is provided. So let say if I don't provide the assignee during start event ,at inclusive gate i can check for the assignee field if it is not present I pass the flow to script task,At this point I have to hold on to a state until i get the assignee before moving to check stock. I don't find a way to get assignee at this point because no task is assigned to any user then how should i get the assignee field?

gdharley
Elite Collaborator
Elite Collaborator

Oh, thats easy.

Use a task listener associated with the "assign" event on the "Check Stock" task.

If there is already an assignee, then fall out of the listener, if there is no assignee, set it on the task (task.setAssignee(id)) frm the variable the script populated.

Greg

Appreciate your help Greg , Thank you so much, I'll try it.

I guess In this case when no assignee is provided I have to set it through listener you mean so  there is no meaning to maintain status as 'unassigned' since in both way it will get to check stock user task and I have to set the status to assigned.