- Thu Jun 08, 2017 9:23 pm
#793163
In my example, the case pauses in task1 when the email is sent out, so it is possible to route the case from Task1 to Task2 with the script in the decision.php file. If you want to send out the email with a trigger in the first task, but you want decision.php to route from the second task to the third task, then you need to set the userId and username fields in your email template to have information about the user assigned to the second task in your process.
Probably the best solution is to set the trigger which sends out the email to fire after routing in the first task. At that point, you can lookup the user which is assigned to the second task in the case in the APP_DELEGATION table, because the record already exists:
= $_GET['username']; In your process, is different, you need to send out the email in the second task or you allow the case to route to Task2,
Probably the best solution is to set the trigger which sends out the email to fire after routing in the first task. At that point, you can lookup the user which is assigned to the second task in the case in the APP_DELEGATION table, because the record already exists:
Code: Select all
Then change your template to this:
$nextIndex = @%INDEX + 1; //index of task 2 in the case
$caseId = @@APPLICATION;
$sql = "SELECT USR_UID FROM APP_DELEGATION WHERE APP_UID='$caseId' AND DEL_INDEX=$nextIndex";
$result = executeQuery($sql);
@@task2UserId = $result[1]['USER_UID'];
$aUser = userInfo(@@userId);
@@task2Username = $aUser['username'];
$to = $aUser['mail'];
$aVars = array(
'task2UserId' => @@task2UserId,
'task2Username' => @@task2Username,
);
@@mailResult = PMFSendMessage(@@APPLICATION, 'admin@example.com',
$to, '', '', 'Approve Purchase Request #'.@@APP_NUMBER, 'approvalForm.html', $aVars);
Code: Select all
<input type="hidden" name="caseId" value="@#APPLICATION">
<input type="hidden" name="index" value="@#INDEX">
<input type="hidden" name="userId" value="@#task2UserId">
<input type="hidden" name="username" value="@#task2Username">
= $_GET['username']; In your process, is different, you need to send out the email in the second task or you allow the case to route to Task2,