- Wed Jan 25, 2012 5:18 pm
#18732
Hi there, I'm having a problem with my escalation process, first I'll explain whata needs to be done, then how am I doing it.
* How should it work:
After a user of the group "Initiators" approves a request each subsequesnt step of the path should wait 40 hours to see if the step has approved the request, if the 40 hours are done, the request (task or case as you wish to call it) should be reassigned to the user of the next level (a mail of notification needs to be sent) and wait another 40 hours. If those 40 are done, we reassign to the next level, and so on. At any point we are going to get to the initial user (it doesn't matter, it should be that way, basically it's a round robin kind of functionality). Each primary group will consist of 1 and ONLY 1 user, each escalation group can have 1 user assigned or none. So if my first primary group is IT_Tech, my escalation groups are IT_Tech_1, IT_Tech_2, etc... I know at this point if my primary group has a user assigned.
* What do I have:
I didn't knew if assign to the step the 40 hours of life time or the fact that I need it to be running indefinitely, I gave it a 365 days of life (on the properties of the step, on Timming Control)(Note: the Allow User Defined Timer Control checkbox is unchecked, if I check it the capture fields dissappear). Then I created an Intermediate Timer Event, I put it as a Single Task, Starts in IT_Tech Approval (My step name), Estimated Task Duration 365 Days, Execution time 0.001 days after interval starts, and to execute the following trigger:
Please help me out guys..
Thanks in advance...
* How should it work:
After a user of the group "Initiators" approves a request each subsequesnt step of the path should wait 40 hours to see if the step has approved the request, if the 40 hours are done, the request (task or case as you wish to call it) should be reassigned to the user of the next level (a mail of notification needs to be sent) and wait another 40 hours. If those 40 are done, we reassign to the next level, and so on. At any point we are going to get to the initial user (it doesn't matter, it should be that way, basically it's a round robin kind of functionality). Each primary group will consist of 1 and ONLY 1 user, each escalation group can have 1 user assigned or none. So if my first primary group is IT_Tech, my escalation groups are IT_Tech_1, IT_Tech_2, etc... I know at this point if my primary group has a user assigned.
* What do I have:
I didn't knew if assign to the step the 40 hours of life time or the fact that I need it to be running indefinitely, I gave it a 365 days of life (on the properties of the step, on Timming Control)(Note: the Allow User Defined Timer Control checkbox is unchecked, if I check it the capture fields dissappear). Then I created an Intermediate Timer Event, I put it as a Single Task, Starts in IT_Tech Approval (My step name), Estimated Task Duration 365 Days, Execution time 0.001 days after interval starts, and to execute the following trigger:
Code: Select all
So I create a new task, fill out the Initiator data, the flow goes to the IT_Tech Step, I wait arround 10-20 minutes and I get the message that the next user has the task, and the task or case disappears from my inbox and it appears on his/her inbox. The problem is that the Event is not run anymore... what's the problem here? function getUserFromGroup($groupName) {
$sql = "SELECT
GU.USR_UID,
CONCAT(U.USR_FIRSTNAME, ' ', U.USR_LASTNAME) AS DisplayName,
U.USR_Email
FROM
`GROUP_USER` GU
INNER JOIN
`CONTENT` C
ON
GU.GRP_UID = C.CON_ID
INNER JOIN
`USERS` U
ON
GU.USR_UID = U.USR_UID
WHERE
UCASE(C.Con_Value) = UCASE('".$groupName."')";
return executeQuery($sql);
}
function isValidUser($userData) {
return (is_array($userData)) && (count($userData) > 0);
}
$currentGroup = @@Current_Group;
$escalationLevel = @@Escalation_Level;
$resultEsc = "";
if($escalationLevel == '') {
$escalationLevel = '_1';
$resultEsc = getUserFromGroup($currentGroup.$escalationLevel);
}
if($escalationLevel == '_1' && !isValidUser($resultEsc)) {
$escalationLevel = '_2';
$resultEsc = getUserFromGroup($currentGroup.$escalationLevel);
}
if($escalationLevel == '_2' && !isValidUser($resultEsc)) {
$escalationLevel = '';
$resultEsc = getUserFromGroup($currentGroup.$escalationLevel);
}
@@Next_User_ID = $resultEsc[1]['USR_UID'];
@@Next_User_Name = $resultEsc[1]['DisplayName'];
@@Next_User_Email = $resultEsc[1]['USR_Email'];
@@Escalation_Level = $escalationLevel;
$caseID = @@APPLICATION;
$result = executeQuery("SELECT count(APP_DOC_UID) as fileQty FROM APP_DOCUMENT WHERE APP_UID='$caseID'");
$fileQty = $result[1]['fileQty'];
$result = executeQuery("SELECT APP_DOC_UID FROM APP_DOCUMENT WHERE APP_UID='$caseID'");
$docID = $result[$fileQty]['APP_DOC_UID'];
$fileName = $docID."_1.html";
$contents = file_get_contents("/opt/processmaker/shared/sites/workflow/files/".$caseID."/outdocs/".$fileName);
$userEmail = @@Next_User_Email;
$caseNumber = @@_Case_ID;
PMFSendMessage(@@APPLICATION, "Workflow Message", $userEmail, "xxxx@yyy.com", "", "Automatic Escalation - Case #".$caseNumber." - New entries found", "OutputDoc.html", array('Contents'=>$contents)); // I've always sent a copy of the email to me.
$resultApp = executeQuery("SELECT USR_UID, DEL_INDEX FROM APP_DELEGATION WHERE APP_UID = '$caseID' ORDER BY DEL_INDEX DESC");
$currentUserID = $resultApp[1]['USR_UID'];
$currentIndex = $resultApp[1]['DEL_INDEX'];
$newUserID = @@Next_User_ID;
$objCase = new Cases();
$objCase->reassignCase($caseID, $currentIndex, $currentUserID, $newUserID);
Please help me out guys..
Thanks in advance...