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.
#824151
Hi support team,
How to redirecting from SubProcess1 to Task1 in the Master Process without going to the list in the inbox. (without displays the Inbox)?

Image

I looked at the Wiki and the forum, unfortunately it was not done! :(
https://wiki.processmaker.com/3.0/Trigg ... edirection
Code: Select all
$caseUID = @@APPLICATION;
$nextIndex = @%INDEX + 1;
header("Location:cases_Open?APP_UID=$caseUID&DEL_INDEX=$nextIndex&action=draft");
die();
#824168
First, the parent case and the subprocess case have different IDs, so you will have to look up the ID of the parent case in the SUB_APPLICATION.APP_PARENT field in the database. Also the delegation index counting is separate in the two cases, so you also need to lookup the number in the DB.

Second, the same user who assigned to the task in the subprocess case also needs to be assigned to "Task1" in the parent process in order to be able to work on the parent case.

Third, the parent case already needs to routed to "Task1". If the subprocess is synchronous, then you need to set your trigger to fire after routing in the last task in the subprocess.

Try this trigger:
Code: Select all
//set to ID of "Task 1" in the parent process: 
$task1Id = 'abcdef1234567890abcdef1234567890'; 

$subcaseId = @@APPLICATION;
//lookup the "Task 1" in the parent case:
$sql = "SELECT ACV.APP_UID, ACV.DEL_INDEX, ACV.USR_UID 
   FROM SUB_APPLICATION SA, APP_CACHE_VIEW ACV
   WHERE SA.APP_PARENT='$caseId' AND SA.APP_PARENT=ACV.APP_UID AND 
   ACV.TAS_UID='$task1Id' AND ACV.DEL_THREAD_STATUS='OPEN'";
$result = executeQuery($sql);

if (empty($result)) {
  throw new Exception("Error in query or no record found: ".$sql);
}

//only set to 'draft' if the current logged user is assigned to "Task1" in the parent case:
$url = 'cases_Open?APP_UID='.$result[1]['APP_UID'].'&DEL_INDEX='.$result[1]['DEL_INDEX'].
    '&action='. (@@USER_LOGGED == $result[1]['APP_UID'] ? 'draft' : 'sent');

header('Location:".$url);
die();
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[…]