Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: ArturoRobles

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.
By Maldayne
#828352
I realised I posted this in the wrong ProcessMaker section (ProcessMaker 2 instead of ProcessMaker 3) so I am reposting here and deleted the old post.

Hi all.

i am hoping someone can help me. We upgraded ProcessMaker two months ago 3.3.10 Community and since have had a few issues that I managed to fix with the help of these forums.

Possibly unrelated to the upgrade, though occuring since July, we have had an issue where the users would receive emails via the ProcessMaker 'PMFSendMessage' function. Unfortunately the variables would not always merge with their values in the email e.g. : @=bus_name in the email template would not change to the business name value like 'Rastamann CC'. There would be no error to indicate any issue with the merging.

The fact that it only happens in some cases is making it really hard to pinpoint what is causing this issue. It has also bought to light that sometimes these cases Case_Title values would also not update with their variables.

This code had not been changed in the past year and has always worked. Most of the process cases don't have this issue, only rare intermittent ones.
We copied the entire environment and I manually tested the exact flow in which the issue only occurred 3 times (not directly after each other), and the rest came through fine.

Afterwards using the same code and template I made a new process and tested it. The first mail came through fine, the second had the issue and the next 105 emails had no issue again.
With a 'for...loop' I sent over 4000 emails to myself, with the same values plus extra incrementing variables for tally, in a short span of time (testing load too) and all of them did not have the issue.

The original code is as follows :
Code: Select all
//Emailing all Participants in a Case

$emailfrom = 'pmwf-workflow-NO-Reply@bdo.com.na';
$appNumber = @@APP_NUMBER;
$caseId = @@APPLICATION; //UID for current case
$users = executeQuery("SELECT DISTINCT USR_UID FROM APP_DELEGATION WHERE APP_UID = '$caseId'");
if (is_array($users) and count($users) > 0) {
   $emailTo;    //empty string to hold the emails of the participants in case
   foreach ($users as $user) {
      $aUser = userInfo($user['USR_UID']);
      $emailTo .= (empty($emailTo) ? "" : "," ) . $aUser['mail'];
   }
   PMFSendMessage(@@APPLICATION, $emailfrom, $emailTo, '', '',
    "Case ".$appNumber." for NonAttest ".@=bus_name." has been approved and opened on Greatsoft", 'notification_gsclient_open_nonattest.html');
	
}
with the Template of the following HTML :
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><font size="3" face="trebuchet ms,geneva">@=bus_name open in Greatsoft - @=gs_client_number</font></p>
<p></p>
<p><font size="2" face="trebuchet ms,geneva">Dear User,</font></p>
<p><font size="2" face="trebuchet ms,geneva">The following Case :</font></p>
<p><b><font size="2" face="trebuchet ms,geneva">@=APP_NUMBER</font></b></p>
<p><font size="2" face="trebuchet ms,geneva">Has been approved and opened on Greatsoft - <b>@=gs_client_number</b></font></p>
<p><font size="2" face="trebuchet ms,geneva">We will provide the following <b>@=ind_email_service</b> services.</font></p>
<p><font size="2" face="trebuchet ms,geneva">Thank You</font></p>
</body>
</html>
And the HTML of the email send according to the ProcessMaker APP_MESSAGE database where the value did not merge:
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><font size="3" face="trebuchet ms,geneva">@=bus_name open in Greatsoft - @=gs_client_number</font></p>
<p></p>
<p><font size="2" face="trebuchet ms,geneva">Dear User,</font></p>
<p><font size="2" face="trebuchet ms,geneva">The following Case :</font></p>
<p><b><font size="2" face="trebuchet ms,geneva">@=APP_NUMBER</font></b></p>
<p><font size="2" face="trebuchet ms,geneva">Has been approved and opened on Greatsoft - <b>@=gs_client_number</b></font></p>
<p><font size="2" face="trebuchet ms,geneva">We will provide the following <b>@=ind_email_service</b> services.</font></p>
<p><font size="2" face="trebuchet ms,geneva">Thank You</font></p>
</body>
</html>

I have attached to this post a .csv of affected entires in the APP_MESSAGE database,
an excel of the delegation of one of the affected cases,
Screen of the System Information,
and my test process Email_test-1.pmx where I have managed to get a confirmed case with the issue occur and then for thousands of emails after it doesn't occur. Take note it has a increment in it to send many emails at once.

If there is any more information required I would be happy to provide it.

Any assistance would be greatly appreciated as I have been digging into this for weeks now and still can't figure out the cause or a solution :cry:
Attachments
System Information.JPG
System Information.JPG (177.97 KiB) Viewed 1562 times
(40.82 KiB) Downloaded 39 times
(13.24 KiB) Downloaded 41 times
(66.42 KiB) Downloaded 39 times

Hello I have the latest version of this app on my[…]

Export Workflow as image

Hello Is there a way to create a process that list[…]

Sometimes the data comes from a user, like when a […]

Found the solution here: https://www.pmusers.com/i[…]