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.
#812612
I have some cases that have 5 or 6 people who participated in it. Is there any way so when someone post a case notes, it doesn't send a notification to everyone when clicking on 'Notify case participants'?. In the database, I guess there is a table that I could use to do that ?

Thanks
#812613
The table being used to create the list of users who participated in the case is the APP_DELEGATION.USR_UID field, but you do not want to edit that table, because you will screw up many things in ProcessMaker.

You can stop an email from being sent out by editing the file workflow/engine/classes/model/AppNotes.php.
Change line 135 from:
Code: Select all
         if ($notify) { 
To:
Code: Select all
         if (false and $notify) { 
#812625
amosbatto wrote:The table being used to create the list of users who participated in the case is the APP_DELEGATION.USR_UID field, but you do not want to edit that table, because you will screw up many things in ProcessMaker.

You can stop an email from being sent out by editing the file workflow/engine/classes/model/AppNotes.php.
Change line 135 from:
Code: Select all
         if ($notify) {
To:
Code: Select all
         if (false and $notify) {
Thanks but I don't want to stop sending notifications to everyone, just to certain people who did not want notifications for certain cases
#812635
Are you a PHP programmer? I can give you a short code example, but you need to be able to adapt it if you want something different.
Change the code in workflow/engine/classes/model/AppNotes.php from:
Code: Select all
        if ($notify) {
            if ($noteRecipients == "") {
                $noteRecipientsA = array ();
                //G::LoadClass( 'case' );
                //$oCase = new Cases();
                $p = $oCase->getUsersParticipatedInCase( $appUid );
                foreach ($p['array'] as $key => $userParticipated) {
                    $noteRecipientsA[] = $key;
                }
                $noteRecipients = implode( ",", $noteRecipientsA );
            }

            $this->sendNoteNotification( $appUid, $usrUid, $noteContent, $noteRecipients );
        } 
To:
Code: Select all
        if ($notify) {
            //list of user IDs (see USERS.USR_UID in database) who shouldn't receive emails for specified processes:
            $aNoEmailUsers = array(
                '1234567890abcde1234567890abcdef',
                'abcde1234567890abcde1234567890'
            );
            //list of process IDs (see PROCESS.PRO_UID in database) which shouldn't receive emails for specified users:
            $aNoEmailProcesses = array( 
                '67890abcde1234567890abcdef12345',
                'de1234567890abcde1234567890abc'
            );
           
            if ($noteRecipients == "") {
                $noteRecipientsA = array ();
                //G::LoadClass( 'case' );
                //$oCase = new Cases();

                $p = $oCase->getUsersParticipatedInCase( $appUid );
                foreach ($p['array'] as $key => $userParticipated) {
                    $noteRecipientsA[] = $key;
                }
                //filter the list of recipients:
                if (in_array($aFields['PRO_UID'], $aNoEmailProcesses) {
                   $aUsers = $noteRecipientsA;
                   $noteRecipientsA = array();
                   foreach ($aUsers as $userId) {
                        if (!in_array($userId, $aNoEmailUsers)) {
                            $noteRecipientsA[] = $userId;
                        }
                   }
                }
                $noteRecipients = implode( ",", $noteRecipientsA );
            }

            $this->sendNoteNotification( $appUid, $usrUid, $noteContent, $noteRecipients );
        } 
You haven't tried this code, so it might require some debug, but it will get you started.
#826207
If it can helps someone later, I needed to send the notes to the requestor (which is in the variable 'rfq_requestor_ID') from the subprocess. So, I modified the code with that:
Code: Select all
if ($notify) {
            if ($noteRecipients == "") {
                $noteRecipientsA = array ();
                G::LoadClass( 'case' );
                $oCase = new Cases();
                $p = $oCase->getUsersParticipatedInCase( $appUid );
                foreach ($p['array'] as $key => $userParticipated) {
                    $noteRecipientsA[] = $key;
                }

                $caseData = $case->loadCase($appUid);
                $proUID = $caseData["PRO_UID"]; //get the process ID
                $oProcess = new Process();
                $proData = $oProcess->Load($proUID);
                if (isset($caseData["APP_DATA"]['rfq_requestor_ID']) && $proData["PRO_SUBPROCESS"] == 1) //verify if variable exists and the process is a subprocess
                {
                    $requestorID = $caseData["APP_DATA"]['rfq_requestor_ID'];
                    if(!in_array($requestorID,$noteRecipientsA)) //to send the email only once in case the the requestor has a task in the subprocess later
                    {
                        $noteRecipientsA[] = $requestorID;
                    }
                }
                $noteRecipients = implode( ",", $noteRecipientsA );
            }

            $this->sendNoteNotification( $appUid, $usrUid, $noteContent, $noteRecipients );
        }
Want to create your own meme coin?

In the world of cryptocurrencies, a unique and exc[…]

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]