UmairAzim wrote: ↑Fri Jan 04, 2019 5:33 am
i have tested it and face only a minor issue, if any one rejects the case it should go back to initiator, but in attached case it is still going to next level, can you please look into it.
Set "Task 1" to use
Value Based Assignment and set the assignment variable to be:
@@firstUserId
valueBasedAssignment.png (47.23 KiB) Viewed 4617 times
Then, create the following trigger:
Code: Select allif (empty(@@firstUserId)) {
@@firstUserId = @@USER_LOGGED;
}
Set this trigger to be executed
Before Assignment in "Task 1".
Here is the updated process:
(119.75 KiB) Downloaded 216 times
Note: This will work as long as "Task 1" is the starting task in the process. If "Task 1" is not the starting task, then you will have to create a trigger in a prior task to set the value of @@firstUserId. If you want to randomly select the user from a pool of users, then you can use this trigger:
Code: Select all$taskTitle = 'Task 1'; //set to the title of the task
if (empty(@@firstUserId)) {
$taskId = PMFGetTaskUID($taskTitle, @@PROCESS);
$d = new Derivation();
$aUsers = $d->getAllUsersFromAnyTask($taskId);
$max = count($aUsers) - 1;
if ($max < 0) {
throw new Exception("No users assigned to $taskTitle");
}
//choose one user randomly from the assignment list:
@@firstUserId = $aUsers[ rand(0, $max) ];
}