You will need to use two processes. First, create your process with a Self Service task which has an exclusive gateway to loop back to the Self Service:
LoopBackToSelfServiceTask.png (18.29 KiB) Viewed 5016 times
The gateway will have these two conditions to either loop back to the Self Service task or route on to Task 3:
RoutingRulesLoopback.png (50.26 KiB) Viewed 5016 times
Then, create a second process with an intermediate timer that will periodically execute a script to check if there are any cases in the other process with the Self Service task which are 1 hour or older:
TimerProcessToExecuteScriptPeriodically.png (15.44 KiB) Viewed 5016 times
Then, add a trigger that routes on all the cases with the Self Service task which haven't been completed after an hour:
Code: Select all//set to the ID of the Self Service task in the "Return To Unassigned" process
//or use PMFGetUidFromText() to get the task ID:
$taskId = '7825264095a726f6e45b0e3018763046';
$anHourAgo = date('Y-m-d H:i:s', strtotime('-1 hour'));
$sql = "SELECT * FROM APP_DELEGATION
WHERE TAS_UID='$taskId' AND DEL_THREAD_STATUS='OPEN' AND
DEL_INIT_DATE IS NOT NULL AND DEL_INIT_DATE < '$anHourAgo'";
$aDelegations = executeQuery($sql);
if (!isset(@=aRoutedCases)) {
@=aRoutedCases = array();
}
$g = new G();
$g->sessionVarSave();
foreach($aDelegations as $aDel) {
$aVars = array(
'returnToUnassigned' => true
);
PMFSendVariables($aDel['APP_UID'], $aVars);
PMFDerivateCase($aDel['APP_UID'], $aDel['DEL_INDEX'], false, $aDel['USR_UID']);
$now = date('Y-m-d H:i:s');
@=aRoutedCases[$now] = $aDel;
$aVars['returnToUnassigned'] = false;
PMFSendVariables($aDel['APP_UID'], $aVars);
}
$g->sessionVarRestore();
I haven't had a chance to test this code, since I'm still waiting for a case to complete an hour, so you will have to test it. You will have to change the UID of $taskId to your Self Service task. You will also need to configure your PM server to periodically execute the
timereventcron.php file, but first manually execute it to verify that the trigger code works correctly.
Here are the two processes to test this:
(35.61 KiB) Downloaded 409 times
(44.71 KiB) Downloaded 409 times