Hello,
To reassign a case with exceeded due date to another user you can use the following:
If your requirement is to
assign an unassigned case to a user from the list of users given for the
Self Service Assignment rule, you can refer the following trigger:
Code: Select all$proid = '95039502258ebffc057e4b0052480462'; // process id
$today = date("Y-m-d H:i:s", strtotime("now"));
$query = "SELECT APP_UID, DEL_DUE_DATE, MAX(DEL_INDEX) FROM LIST_UNASSIGNED WHERE PRO_UID = '$proid' AND DEL_DUE_DATE <= '$today' GROUP BY APP_UID";
$result = executeQuery($query);
if(is_array($result) and count($result)>0){
foreach($result as $res){
$caseid = $res['APP_UID'];
$delindex = $res['MAX(DEL_INDEX)'];
$designatedUser = '00000000000000000000000000000001'; // id of user from the assigned users list of the task
$c = new Cases();
$c->setCatchUser($caseid, $delindex + 1, $designatedUser);
}
}
If you have a different requirement, i.e. you need to
reassign an already assigned case, you can refer to the below-given trigger.
The following trigger will work for the case which is already has a user assigned but has exceeded the due date:
Code: Select all$proid = '95039502258ebffc057e4b0052480462'; // process id
$today = date("Y-m-d H:i:s", strtotime("now"));
$query = "SELECT APP_UID, DEL_TASK_DUE_DATE, MAX(DEL_INDEX), USR_UID FROM APP_DELEGATION WHERE PRO_UID = '$proid' AND DEL_TASK_DUE_DATE <= '$today' GROUP BY APP_UID";
$result = executeQuery($query);
if(is_array($result) and count($result)>0){
foreach($result as $res){
$caseid = $res['APP_UID'];
$delindex = $res['MAX(DEL_INDEX)'];
$curruser = $res['USR_UID'];
$designatedUser = '00000000000000000000000000000001'; // id of the new user to be assigned
$c = new Cases();
@@boolean = $c->reassignCase($caseid, $delindex, $curruser, $designatedUser, 'REASSIGN');
}
}
I hope this fulfills your requirement. I am still working on the ad-hoc lists and will feedback you as and when I get to know anything helpful.
Hope this helps
Best Regards
Mishika