Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#794275
What I am trying to accomplish is email certain people based on if a checkbox is checked on a form. So we have about 10 different checkboxes that represent different systems. So if a particular checkbox is checked it should email a staff to notify them that they need to create them an account. The email is just a notification only. They don't need to approve it or anything like that. Thoughts on how I can accomplish this?
#794367
Here are the steps to do this:
1. Create an email template. In this example, the filename is "myEmailTemplate", which is stored as "'myEmailTemplate.html". This filename will be used in the trigger code.
2. Create a group in ProcessMaker named "Users to Notify" which contains all the users who can receive the email.
3. Then, create a DynaForm which contains a checkgroup associated with a case variable named "usersToNotify".
4. Then, create an array variable in process designer with the name "availableUsersToNotify".
5. In the properties of the "usersToNotify" checkgroup in the DynaForm designer, set the "data source" to "Array Variable" and the "data variable" to @@availableUsersToNotify. See: http://wiki.processmaker.com/3.0/DynaFo ... Datasource

6. Add the following trigger to your process:
Code: Select all
@=availableUsersToNotify = array();
$groupId = PMFGetGroupUID("Users to Notify");
if (!empty($groupId)) {
   $aUsers = PMFGetGroupUsers($groupId)
   foreach ($aUsers as $aUser) {
      @=availableUsersToNotify[] = array($aUser['USR_EMAIL'], $aUser['USR_FIRSTNAME'] .' '. $aUser['USR_LASTNAME']);
   }
}
Set this trigger to fire before the DynaForm containing the checkgroup.

7. Add the following trigger to your process:
Code: Select all
if (isset(@=usersToNotify) and !empty(@=usersToNotify)) {
   $to = '';
   foreach(@=usersToNotify as $email) {
       $to = (empty($to) ? '' : ', ') . $email;
   }
   PMFSendMessage(@@APPLICATION, 'admin@example.com', $to, '', '', 'My email subject line', 'myEmailTemplate.html');
}
Set this trigger to fire after the DynaForm containing the checkgroup.

See the documentation for all functions in the trigger code so you understand what the code does.

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]