Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By UmairAzim
#822244
How can i assign a task in Parallel to 4 Users. and if any of the user reject the task, it should go back to initiator, task only go to next step if only approved by all users. please help i am stuck in it.
#822261
Appreciate your help in answering my question.
exactly the same process which i want. 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.
Thanks in advance for your time.
#822265
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
valueBasedAssignment.png (47.23 KiB) Viewed 4617 times
Then, create the following trigger:
Code: Select all
if (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) ]; 
}
#822315
amosbatto wrote: Fri Jan 04, 2019 9:56 pm By the way, here is a more flexible way of doing the same thing:
https://www.pmusers.com/index.php/Loop_ ... prior_task
Thanks Amos for you Help, i have created the attached process, bu facing some issues, can you please help me in it. task assigned to all users successfully, but when users try to approve it it shows an error (Parse error: syntax error, unexpected '‘reject’' (T_STRING) in C:\opt\apps\processmaker\htdocs\workflow\engine\classes\class.pmScript.php(532) : eval()'d code on line 3).

Please help
Attachments
(129.95 KiB) Downloaded 218 times
User avatar
By amosbatto
#822318
UmairAzim wrote:Thanks Amos for you Help, i have created the attached process, bu facing some issues, can you please help me in it. task assigned to all users successfully, but when users try to approve it it shows an error (Parse error: syntax error, unexpected '‘reject’' (T_STRING) in C:\opt\apps\processmaker\htdocs\workflow\engine\classes\class.pmScript.php(532) : eval()'d code on line 3).
I can't reproduce that error message on my machine (PM 3.3.0 Community in Debian 9.5 with php 5.6.37). What I did find is that your variable in the "Initiator" task is wrong. You need to change it from @@firstUser to @@firstUserId :
ValueBasedAssignmentWithVariable.png
ValueBasedAssignmentWithVariable.png (57.04 KiB) Viewed 4565 times
#822342
amosbatto wrote: Wed Jan 09, 2019 10:13 pm
UmairAzim wrote:Thanks Amos for you Help, i have created the attached process, bu facing some issues, can you please help me in it. task assigned to all users successfully, but when users try to approve it it shows an error (Parse error: syntax error, unexpected '‘reject’' (T_STRING) in C:\opt\apps\processmaker\htdocs\workflow\engine\classes\class.pmScript.php(532) : eval()'d code on line 3).
I can't reproduce that error message on my machine (PM 3.3.0 Community in Debian 9.5 with php 5.6.37). What I did find is that your variable in the "Initiator" task is wrong. You need to change it from @@firstUser to @@firstUserId :
ValueBasedAssignmentWithVariable.png

Thanks Amos, i have change the Id and aslo did some changes in trigger, finally its working fine.

I wanted to express my personal gratitude for the effort and extra time you have contributed. :D :D :D :D

Being the best in the started business is the obje[…]

Winzo is a popular and unique game on the mobile p[…]

Cannot create process using templets

Real details. The problem was solved by effect!

However, it is essential to use it responsibly and[…]