I assume that you assigned the new case to another user, so if you want to execute a trigger inside that new case, you need to use REST to login as that other user. Then call the execute-trigger endpoint as that other user.
However, this is problem if you don't know the password of the other user. What you can do is create a separate process which has the following trigger:
Code: Select allif (isset(@@newCaseId) and !empty(@@newCaseId)) {
$c = new Cases();
$aCase = $c->loadCase(@@newCaseId, 1);
$aCase['APP_STATUS'] = 'TO_DO';
$c->updateCase($newCaseId, $aCase);
/*Add this code if using PM 3.2:
//change the status of the case in the Home > Participated list:
$aData = array(
'APP_UID' => $aCase['APP_STATUS'];
'USR_UID' => $aCase['CURRENT_USER_UID'];
'DEL_INDEX' => $aCase['DEL_INDEX'],
'APP_STATUS' => 'TO_DO';
);
$oListPartLast = new ListParticipatedLast();
$oListPartLast->update($aData);
*/
@@newCaseId = ""; //reset so empty for next time
}
Then create a permanent case in that process with the same user that you use in your REST script. Don't ever finish the case so you can always use the same case over and over to execute the trigger. Run the case in debug mode so you can see the case ID found in the APPLICATION variable. Copy it down and use the case ID in your REST code.
Then in your rest script, first call the POST /cases endpoint to create the new case. Then call
PUT /cases/{app_uid}/variable on your permanent case where you have the trigger. You can always use the same case to execute your trigger, as long as you never close the case. Set the variable newCaseId in your permanent case to the ID of the new case that was created with POST /case. Finally, call the /execute-trigger endpoint in your permanent permanent case to execute the trigger.
By the way, which version of PM are you using. I think in PM 3.2, this got fixed (or it was supposed to be fixed).