Questions and discussion about using ProcessMaker: user interface, running cases & functionality

Moderator: amosbatto

#784313
Greetings!

We're using ProcessMaker Community Edition 3.0.1.5.

My question is... how do I send reminder e-mails to those users whose tasks have not been completed within the time allotted in the timing control in the task?

Any thoughts or ideas would be most appreciated.

Thanks!

Patrick W. Soileau ("swallow")
UNIX System Programmer
University of Louisiana at Lafayette
[email protected]
#784326
change to your domain and from email, put in a trigger, add as a step to a task, run nightly
Code: Select all
//Get List of Users
$user_array = PMFUserList();

if (is_array($user_array)) {

	//Loop on users
	foreach ($user_array as $user_row) {
		$userUID 	= $user_row['guid'];
        	$userName	= $user_row['name'];
		$isToBeSent 	= 'FALSE';

		//Remove the Administrator notif
		//if ($userName <> 'Administrator') {

			//Init Case Recap CONTENT for the user
			$recapCONTENTStr =	'<table border="1">'.
						'<tr>'.
						'<td>#</td>'.
						'<td>Process</td>'.
						'<td>Task</td>'.
						'<td>Label</td>'.
						'<td>Status</td>'.
						'<td>Received on</td>'.
						'<td>Pending</td>'.
						'<td>Link</td>'.
						'</tr>';
	
			//Get List of Case for each user
			$case_array	= PMFCaseList($userUID);

			//Loop on User Cases
			foreach($case_array as $case_row) {
				$caseUID 	= $case_row['guid'];
				$caseNumber	= $case_row['name'];
				$caseStatus	= $case_row['status'];

				//Only consider Status = TO_DO
				if ($caseStatus == 'TO_DO') {
			
					//Get The Task Name
					$task_array 	= PMFTaskCase($caseUID);			
					$taskName 	= $task_array[1]['name'];

					//Get the Process Name from the TaskID
					$query = "SELECT 	CONTENT.CON_VALUE, 
								DATE(DEL_DELEGATE_DATE) AS DATE_RECEIVED,
								DATEDIFF(NOW(),DEL_DELEGATE_DATE) AS PENDING_DAYS, 
								DEL_INDEX, APPLICATION.APP_UID
						
						FROM	APPLICATION 	
							INNER JOIN CONTENT ON APPLICATION.PRO_UID = CONTENT.CON_ID
							INNER JOIN APP_DELEGATION	ON APPLICATION.APP_UID = APP_DELEGATION.APP_UID
						
						WHERE	CONTENT.CON_LANG			= 'en'
						AND	CONTENT.CON_CATEGORY			= 'PRO_TITLE' 
						AND	APP_DELEGATION.DEL_THREAD_STATUS	= 'OPEN'
						AND	APPLICATION.APP_UID			= '".$caseUID."'";

					
					$queryResult = executeQuery($query);

					if (is_array($queryResult ) and count($queryResult ) > 0) {
						$processName 	= $queryResult[1]['CON_VALUE'];
						$dateReceived	= $queryResult[1]['DATE_RECEIVED'];
						$pendingDays 	= $queryResult[1]['PENDING_DAYS'].' day(s)';
						$curIndex 	= $queryResult[1]['DEL_INDEX'];
						//get the task case label
						$task_title_query = "SELECT CON_VALUE FROM CONTENT WHERE CON_CATEGORY='APP_TITLE' AND CON_ID='".$queryResult[1]['APP_UID']."'";
						$queryResultTask = executeQuery($task_title_query);
						$caselabel = $queryResultTask[1]['CON_VALUE'];
                        		}
					

					//Build Link to open the case
					$linkCase = 	'<a href="https://yourworkflowdomain.com/sys'[email protected]=SYS_SYS.'/'[email protected]=SYS_LANG.'/'[email protected]=SYS_SKIN.'/cases/cases_Open?'.'APP_UID='.$caseUID.'&DEL_INDEX='.$curIndex.'" target="_blank">open</a>'; 

					//Build the Sentence including case misc. info
					$recapCONTENTStr .=	'<tr>'.
                                 	    		       	'<td>'.$caseNumber 	.'</td>'.
								'<td>'.$processName	.'</td>'.
								'<td>'.$taskName   	.'</td>'.
								'<td>'.$caselabel 	.'</td>'.
								'<td>'.$caseStatus 	.'</td>'.
								'<td>'.$dateReceived 	.'</td>'.
								'<td>'.$pendingDays 	.'</td>'.
								'<td>'.$linkCase 	.'</td>'.
								'</tr>';
					$isToBeSent = 'TRUE';
				}
			}

                	//Complete the Case Recap CONTENT for the user
               		$recapCONTENTStr .= '</table>';
			@@RECAP_CONTENT = $recapCONTENTStr;

			//Send Email if existing TO-DO tasks
			if ($isToBeSent == 'TRUE') {

				//Send Email
				$u = new Users();
				$aUserInfo = $u->Load($userUID);

				@@CC_USER 	= $aUserInfo["USR_LASTNAME"] . ' ' . $aUserInfo["USR_FIRSTNAME"];
   				$userEmail 	= $aUserInfo['USR_EMAIL'];  


				$aFields = array('CC_USER' => @@CC_USER, 'RECAP_CONTENT' => @@RECAP_CONTENT);



				@@EMAIL_RESULT = PMFSendMessage(@@APPLICATION,'[email protected]',$userEmail,'','',"Task Reminders",'recapReminder.html',$aFields);

			}
		//}
	}
}

here is a basic recapreminder template
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
</head>
<body>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: small;">Dear @#CC_USER,</span></p>
<p><font face="arial,helvetica,sans-serif" size="2">Your current workflow task(s):</font></p>
<p><font face="arial,helvetica,sans-serif" size="2"><strong>@#RECAP_CONTENT</strong></font></p>
</body>
</html>

hi His main problem is that he wants to make a pr[…]

Yes, there is a limit to executeQuery() function. […]

I found the solution, I must use case_Open like […]

Hi dan123dan, Thank you for the reply and providi[…]