Questions and discussion about using ProcessMaker: user interface, running cases & functionality
#795820
A sub-process can't be the first activity in a process. However, the PMFDerivateCase() function can be called in a trigger to automatically bypass the starting task in the master case. Then, header() can be used to redirect to the first task in the sub-process case.

Here are the steps to implement it:
1. Create a starting task in your master process, which is empty. Assign this starting task to the same users who are assigned to the first task in your sub-process.
masterProcessDummyStartingTask.png
masterProcessDummyStartingTask.png (8.85 KiB) Viewed 2942 times
2. In the master process and the sub-process, create a string variable named "firstUserId".
firstUserIdVariableInMasterProcess.png
firstUserIdVariableInMasterProcess.png (12.83 KiB) Viewed 2942 times
3. In the properties of the sub-process, set the "firstUserId" variable to be passed from the master process to the sub-process.
VariablesToPassToSubprocess.png
VariablesToPassToSubprocess.png (34.01 KiB) Viewed 2942 times


4. In the first task of the sub-process, edit its Assignment Rules. Set the first task to use Value Based Assignment and set the variable to be @@firstUserId.

5. Return to the master process and create the following trigger in the master process:
Code: Select all
//Set the user to assign to the first task in the sub-process:
PMFSendVariables(@@APPLICATION, array("firstUserId" => @@USER_LOGGED));

$ret = PMFDerivateCase(@@APPLICATION, @%INDEX);
if ($ret == 0) {
    throw new Exception("Unable to route case: ".@@__ERROR__);
}
    
$parentCaseId = @@APPLICATION;
$sql = "SELECT * FROM SUB_APPLICATION WHERE APP_PARENT='$parentCaseId'";
$result = executeQuery($sql);
if (empty($result)) {
    throw new Exception("Unable to find subprocess case for $parentCaseId.");
}
$subcaseUrl = 'cases_Open?APP_UID='.$result[1]['APP_UID'].
    '&DEL_INDEX=1&action=todo';
header('location:'.$subcaseUrl);
die; 
Set this trigger to fire before assignment in the starting task of the master process.

Now when a new case is started in the master process, it should automatically bypass the starting task in the master process and redirect to the first task in the sub-process.

Here are the master process and sub-process to test this:
(38.05 KiB) Downloaded 294 times
(21.55 KiB) Downloaded 281 times

To take Cenforce 120mg tablet, follow the guidelin[…]

ICO software script is a pre-made program for crea[…]

A crypto exchange script is a pre-designed softwar[…]

So I recently bought an addmotor Ebike which of co[…]