Questions and discussion about using ProcessMaker: user interface, running cases & functionality
By springhigh
#812367
Hi There.
Is there a way to auto assign a user between steps without their actual participation.
i.e "User 1" Submits a Case to "User 3"
( but between these steps "User 2" will be briefly "touched" and be able to preview the case in their participated list.
many thanks.
User avatar
By amosbatto
#812380
Let's say that you have the following process:
AddParticipatedUserProcess.png
AddParticipatedUserProcess.png (6.36 KiB) Viewed 2946 times
Create the following trigger that temporarily assigns the next task to a specified user (who is also in the Ad Hoc Assignment list for the next task). Then it reassigns to the next task back to the normally assigned user.
Code: Select all
//Set to the username which will participate in the case.
//Make sure that this user is in the Ad Hoc Assignment list for the 
//next task in the process.
$participatedUsername = 'amos';

require_once 'classes/model/Users.php';
$u = new Users();
$aUserInfo = $u->loadByUsernameInArray($participatedUsername);
if (!is_array($aUserInfo) or empty($aUserInfo)) {
    throw new Exception("User '$participatedUsername' does not exist.");
}
$participatedUserId = $aUserInfo['USR_UID'];    

//look up details about the next task of the current case in the database:
$caseId = @@APPLICATION;
$sql = "SELECT * FROM APP_DELEGATION WHERE APP_UID='$caseId' ORDER BY DEL_INDEX DESC"; 
$aTasks = executeQuery($sql);

$nextUserId = $aTasks[1]['USR_UID'];
$nextIndex  = $aTasks[1]['DEL_INDEX'];

//reassign case to $participatedUserId    
$c = new Cases();
$c->reassignCase($caseId, $nextIndex, $nextUserId, $participatedUserId);
    
//reassign case back to $nextUserId:
$c->reassignCase($caseId, $nextIndex + 1, $participatedUserId, $nextUserId); 
Set this trigger to fire after routing in Task 1:
AddParticipatedUserSetTrigger.png
AddParticipatedUserSetTrigger.png (35.9 KiB) Viewed 2946 times
Make sure to fire the trigger after routing, so that the SQL query will always get the most recent routed task in APP_DELEGATION. Otherwise, you will need to specify the ID of the task when querying the APP_DELEGATION table.

Now the user specified in the $participatedUsername will be able to see the case when he/she goes to to Home > Participated.

Here is a sample process so that you test it:
(29.49 KiB) Downloaded 314 times
Want to create your own meme coin?

In the world of cryptocurrencies, a unique and exc[…]

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]