Questions and discussion about using ProcessMaker: user interface, running cases & functionality
#822949
Hi all, here's where I'm stuck. Here's what my workflow looks like:
Image

Here's what I'm trying to do.. a document gets submitted and all 5 approvers have the opportunity to approve it. Once one of them approves it the workflow should continue for 1 case and the other 4 cases should do nothing (go to far right) End Event.

Image

After one of the approvers reviews the dynaform and approves the request it should run the trigger. The code for the trigger I got in the forums:
Code: Select all
$caseId = @@APPLICATION;

@@task_taken = true;
//set to the IDs of the 3 parallel tasks. 
//(You can find them by looking at the @@TASK variable in the Debugger while running cases):
$aTasks = array(
	'3645403925c65af61c647f7058166380',  
	'6646433025c65af62050a49044001044', 
	'2666452175c65af60ccf6c6025265082', 
	'1360269725c65af619bcdd4054211402',
		'8891732165c65af60ac2f99040883054'
);
$aTasksToCancel = array();
foreach ($aTasks as $taskId) {
   if ($taskId != @@TASK)
      $aTasksToCancel[] = $taskId;
}
foreach ($aTasksToCancel as $taskId) {      
   // select = @@APPLICATION;
   //lookup the delegation index and the user name and the MD5 hash of that user assigned to the other parallel task:
   $query = "select AD.DEL_INDEX, RU.USR_USERNAME, RU.USR_PASSWORD
      from APP_DELEGATION AD, RBAC_USERS RU
      where AD.APP_UID='$caseId' and AD.TAS_UID='$taskId' and AD.DEL_THREAD_STATUS='OPEN' and
      AD.USR_UID=RU.USR_UID ";
   $result = executeQuery($query);
   if (!is_array($result) or count($result) == 0)
      die("Error in query:<br>$query<br>Or there is no parallel task.");

   $delIndex = $result[1]['DEL_INDEX'];
   $username = $result[1]['USR_USERNAME'];
   $pass = 'md5:' . $result[1]['USR_PASSWORD'];
   $url = 'https://'. $_SERVER['SERVER_NAME']
    . '/sys' . @@SYS_SYS . '/en/classic/services/wsdl2';
   //login via web services:
   $client = new SoapClient($url);
   $params = array(array('userid'=>$username, 'password'=> $pass));
   $result = $client->__SoapCall('login', $params);

   if ($result->status_code == 0)
       $sessionId = $result->message;
   else
       die('Unable to connect to ProcessMaker.<br>Error Message:<br>' . $result->message);
  
   
   $params = array(array(
      'sessionId' => $sessionId,
      'caseId'      => $caseId,
      'delIndex'   => $delIndex
   ));
   $result = $client->__SoapCall('routeCase', $params);
   if ($result->status_code != 0)
     die("Error routing case:<br>" . $result->message); 
   
}
Here's what the case layout looks like after it is created (this is as expected):
Image

This is what it looks like after one of the members approves it:
Image

I want to have only 1 flow go to the Create Eventbrite and the other 4 to End.. it seems like the trigger only ever runs on 1 of the previous tasks. I did verify the Task IDs were correct by querying mysql. What am I doing wrong?

Thanks for any help.
#822957
You have a diverging inclusive gateway to split into 5 paths, so you need a converging inclusive gateway to join the 5 paths into one path. (If you don't do this, then you will see 5 cases, instead of 1 case.) Then, use an diverging exclusive gateway after that to split into 2 paths:
parallelTasks.png
parallelTasks.png (23.08 KiB) Viewed 2313 times
Does your trigger to route on the other parallel tasks work correctly? (I can't tell from your screenshots.)

If not, here is a simpler way to do it:
https://www.pmusers.com/index.php/Routi ... llel_tasks
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[…]