Thank you Amos.
Than, I was on the right way. Here is my solution (you have to create separate triggers for each desired self-service-assigned task)
I created a trigger-template, which just needs the manual configuration of a few variables for each task.
The trigger sends out an eMail to all assigned users and groups !
Limitation: If a user is assigned two times to the task (f.e. group + user), he will receive two mails.
1. create/copy the trigger and name it unique (f.e. with taskname in the triggername)
2. change the variable $taskname to the name of the task with the self-service assignment (exact match)
3. change $MailSender and $MailSubject to your desire
4. create a html-template and name it in the variable $MailTemplate
Then, you can use this trigger in the timeout-section of the self-service-assignment of that task.
Code: Select all// Please fill variables:
// ===========================
$taskname = "do something";
$MailSender = 'My-ProcessMaker <info@processmaker.mydomain.de>';
$MailSubject = "Reminder: There are unassigned cases !";
$MailTemplate = 'ReminderMail.html';
// ===========================
// --------------------
// identify the Task-ID
// --------------------
$taskID=PMFGetTaskUID($taskname, @@PROCESS);
// ----------------
// Mails to groups
// ----------------
// TU_TYPE represents association-type: direct(1) or adhoc(2)
// TU_RELATION represents user(1) or grupps(2)
$resultG = executeQuery("SELECT USR_UID from TASK_USER where TAS_UID='" . $taskID . "' and TU_TYPE=1 and TU_RELATION=2");
if (count($resultG) >0) {
foreach ($resultG as $rowG) {
$toG = $rowG['USR_UID'];
PMFSendMessageToGroup($toG, @@APPLICATION, $MailSender, $MailSubject, $MailTemplate, array(''), array(''), true, 0, "");
}
}
// --------------
// Mails to users
// --------------
// TU_TYPE represents association-type: direct(1) or adhoc(2)
// TU_RELATION represents user(1) or grupps(2)
$resultU = executeQuery("SELECT USR_UID from TASK_USER where TAS_UID='" . $taskID . "' and TU_TYPE=1 and TU_RELATION=1");
if (count($resultU) >0) {
foreach ($resultU as $rowU) {
$UserID = $rowU['USR_UID'];
$aUser = userInfo($UserID);
$toU = $aUser['mail'];
PMFSendMessage(@@APPLICATION, $MailSender, $toU, '', '', $MailSubject, $MailTemplate, array());
}
}
Maybe anyone can use it ...
Have a nice weekend,
Stephan