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

Moderator: amosbatto

By atuly7
#789023
Hi,
I want to attach generated output document to email. I used wiki code for it and put mailBody variable in html. But it didn't work. I got email but didn't find output document. What should I change in code?
Code is here.
Code: Select all
$docId = '954109698491477e1986b43042252891'; //set to the Output Document's unique ID
PMFGenerateOutputDocument($docId);
//find the generated Output Document in the wf_&<WORKSPACE>.APP_DOCUMENT table
$query = "SELECT MAX(DOC_VERSION) AS MAX_VERSION, APP_DOC_UID FROM APP_DOCUMENT 
   WHERE APP_UID = '$caseId' AND DOC_UID='$docId'";
$result = executeQuery($query);
if (is_array($result) and count($result) > 0) {
   $pathFilename = PATH_DOCUMENT . G::getPathFromUID(@@APPLICATION) . PATH_SEP . 'outdocs'. PATH_SEP . 
      $result[1]['APP_DOC_UID'] . '_' . $result[1]['MAX_VERSION'] . '.html';
   $body = file_get_contents($pathFilename);
   PMFSendMessage(@@APPLICATION, '[email protected]', userInfo(@@USER_LOGGED)['mail'], '', '',
      'Generated Output Document', 'outDocMail.html', array('mailBody' => $body));
}
thanks & Regards
User avatar
By amosbatto
#789032
Use the following code to send a generated Output Document's PDF as an email attachment to all the users who have participated in the current case:
Code: Select all
$docId = '954109698491477e1986b43042252891'; //set to the Output Document's unique ID
$fileId = PMFGenerateOutputDocument($docId);
if (empty($fileId)) {
   throw new Exception("Error: Unable to generate Output Document with ID '$docId'.");
}
else {
   $oDoc = new AppDocument();
   $aDocInfo = $oDoc->load($fileId);
   $ext = '.pdf';  //set to '.doc' if sending a DOC file
   $pathToFile = PATH_DOCUMENT . G::getPathFromUID(@@APPLICATION) . PATH_SEP . 'outdocs' . 
      PATH_SEP . $fileId . '_' . $aDocInfo['DOC_VERSION'] . $ext;
   $filename = $aDocInfo['APP_DOC_FILENAME'] . $ext;
   $aAttachments = array(
      $filename => $pathToFile
   ); 
   $c = new Cases();
   $aUsers = $c->getUsersParticipatedInCase(@@APPLICATION);
   $to = '';
   foreach ($aUsers['array'] as $userUID => $userInfo) {
      $to .= (empty($to) ? '' : ', ') . $userInfo['USR_EMAIL'];
   }   
   PMFSendMessage(@@APPLICATION, '[email protected]', $to, '', '',
      'Document for case #'[email protected]@APP_NUMBER, 'caseInfo.html', array(), $aAttachments);
}
By atuly7
#789038
amosbatto wrote:Use the following code to send a generated Output Document's PDF as an email attachment to all the users who have participated in the current case:
Code: Select all
$docId = '954109698491477e1986b43042252891'; //set to the Output Document's unique ID
$fileId = PMFGenerateOutputDocument($docId);
if (empty($fileId)) {
   throw new Exception("Error: Unable to generate Output Document with ID '$docId'.");
}
else {
   $oDoc = new AppDocument();
   $aDocInfo = $oDoc->load($fileId);
   $ext = '.pdf';  //set to '.doc' if sending a DOC file
   $pathToFile = PATH_DOCUMENT . G::getPathFromUID(@@APPLICATION) . PATH_SEP . 'outdocs' . 
      PATH_SEP . $fileId . '_' . $aDocInfo['DOC_VERSION'] . $ext;
   $filename = $aDocInfo['APP_DOC_FILENAME'] . $ext;
   $aAttachments = array(
      $filename => $pathToFile
   ); 
   $c = new Cases();
   $aUsers = $c->getUsersParticipatedInCase(@@APPLICATION);
   $to = '';
   foreach ($aUsers['array'] as $userUID => $userInfo) {
      $to .= (empty($to) ? '' : ', ') . $userInfo['USR_EMAIL'];
   }   
   PMFSendMessage(@@APPLICATION, '[email protected]', $to, '', '',
      'Document for case #'[email protected]@APP_NUMBER, 'caseInfo.html', array(), $aAttachments);
}
Thanks for reply. But it's not working. I copied your code and pasted it and changed output document id. Placed that trigger before routing. Do I need to change anything else?
Thanks & Regards
By atuly7
#789039
atuly7 wrote:
amosbatto wrote:Use the following code to send a generated Output Document's PDF as an email attachment to all the users who have participated in the current case:
Code: Select all
$docId = '954109698491477e1986b43042252891'; //set to the Output Document's unique ID
$fileId = PMFGenerateOutputDocument($docId);
if (empty($fileId)) {
   throw new Exception("Error: Unable to generate Output Document with ID '$docId'.");
}
else {
   $oDoc = new AppDocument();
   $aDocInfo = $oDoc->load($fileId);
   $ext = '.pdf';  //set to '.doc' if sending a DOC file
   $pathToFile = PATH_DOCUMENT . G::getPathFromUID(@@APPLICATION) . PATH_SEP . 'outdocs' . 
      PATH_SEP . $fileId . '_' . $aDocInfo['DOC_VERSION'] . $ext;
   $filename = $aDocInfo['APP_DOC_FILENAME'] . $ext;
   $aAttachments = array(
      $filename => $pathToFile
   ); 
   $c = new Cases();
   $aUsers = $c->getUsersParticipatedInCase(@@APPLICATION);
   $to = '';
   foreach ($aUsers['array'] as $userUID => $userInfo) {
      $to .= (empty($to) ? '' : ', ') . $userInfo['USR_EMAIL'];
   }   
   PMFSendMessage(@@APPLICATION, '[email protected]', $to, '', '',
      'Document for case #'[email protected]@APP_NUMBER, 'caseInfo.html', array(), $aAttachments);
}
Thanks for reply. But it's not working. I copied your code and pasted it and changed output document id. Placed that trigger before routing. Do I need to change anything else?
It shows this error
Invalid argument supplied for foreach()

Thanks & Regards
By zainab
#789041
To send an output document as an email you can use the code below, which works for me. Though it similar to what Amos suggested but with a few modifications, either way is correct:
Code: Select all
$aAttachFiles = array();
$caseId = @@APPLICATION;
$outDocDef = "521147317586deca3990a44078463657";

PMFGenerateOutputDocument($outDocDef);

$outDocQuery = "SELECT AD.APP_DOC_UID, AD.DOC_VERSION, C.CON_VALUE AS FILENAME
FROM APP_DOCUMENT AD, CONTENT C
WHERE AD.APP_UID='$caseId' AND AD.DOC_UID='$outDocDef' AND
AD.APP_DOC_STATUS='ACTIVE' AND AD.DOC_VERSION = (
SELECT MAX(DOC_VERSION) FROM APP_DOCUMENT WHERE APP_UID='$caseId' AND
DOC_UID='$outDocDef' AND APP_DOC_STATUS='ACTIVE')
AND AD.APP_DOC_UID = C.CON_ID AND C.CON_CATEGORY = 'APP_DOC_FILENAME'";

$outDoc = executeQuery($outDocQuery);
@@outDoc = $outDoc;
$temp = G::getPathFromUID($caseId);
if (is_array($outDoc) and count(outDoc) > 0)
{
    $path = PATH_DOCUMENT . $temp . PATH_SEP . 'outdocs'. PATH_SEP . $outDoc[1]['APP_DOC_UID'] . '_' . $outDoc[1]['DOC_VERSION'];
    $filename = $outDoc[1]['FILENAME'];
    $aAttachFiles[$filename . '.pdf'] = $path . '.pdf';
}


PMFSendMessage(@@APPLICATION, "[email protected]", "[email protected]", "", "", "hey", "out.html", array(''), $aAttachFiles, TRUE, 0, "");
Last edited by zainab on Mon Feb 13, 2017 2:26 am, edited 1 time in total.
By atuly7
#789046
zainab wrote:To send an output document as an email you can use the code below, which works for me. Though it similar to what Amos suggested but with a few modifications, either way is correct:
Code: Select all
$aAttachFiles = array();
$caseId = @@APPLICATION;
$outDocDef = "521147317586deca3990a44078463657";

PMFGenerateOutputDocument($outDocDef);

$outDocQuery = "SELECT AD.APP_DOC_UID, AD.DOC_VERSION, C.CON_VALUE AS FILENAME
FROM APP_DOCUMENT AD, CONTENT C
WHERE AD.APP_UID='$caseId' AND AD.DOC_UID='$outDocDef' AND
AD.APP_DOC_STATUS='ACTIVE' AND AD.DOC_VERSION = (
SELECT MAX(DOC_VERSION) FROM APP_DOCUMENT WHERE APP_UID='$caseId' AND
DOC_UID='$outDocDef' AND APP_DOC_STATUS='ACTIVE')
AND AD.APP_DOC_UID = C.CON_ID AND C.CON_CATEGORY = 'APP_DOC_FILENAME'";

$outDoc = executeQuery($outDocQuery);
@@outDoc = $outDoc;
$temp = G::getPathFromUID($caseId);
if (is_array($outDoc) and count(outDoc) > 0)
{
    $path = PATH_DOCUMENT . $temp . PATH_SEP . 'outdocs'. PATH_SEP . $outDoc[1]['APP_DOC_UID'] . '_' . $outDoc[1]['DOC_VERSION'];
    $filename = $outDoc[1]['FILENAME'];
    $aAttachFiles[$filename . '.pdf'] = $path . '.pdf';
}


PMFSendMessage(@@APPLICATION, "[email protected]", "[email protected]", "", "", "hey", "out.html", array(''), $aAttachFiles, TRUE, 0, "");
Thanks for reply. But I want to send a generated Output Document's PDF as an email attachment to all the users who have participated in the current case.
Thanks & Regards
User avatar
By amosbatto
#789047
Yes, I made a mistake in the code I posted. This code should work. Also I have attached a sample process to test it.
Code: Select all
$docId = '689651513589ddf6adc5195091736966'; //set to the Output Document's unique ID
$caseId = @@APPLICATION;
PMFGenerateOutputDocument($docId);
$sql = "SELECT APP_DOC_UID FROM APP_DOCUMENT WHERE APP_UID='$caseId' AND DOC_UID='$docId'";
$aNewDoc = executeQuery($sql);

if (empty($aNewDoc)) {
   throw new Exception("Error: Unable to generate Output Document with ID '$docId'.");
}
else {	
   $fileId = $aNewDoc[1]['APP_DOC_UID'];
   $oDoc = new AppDocument();
   $aDocInfo = $oDoc->load($fileId);
   $ext = '.pdf';  //set to '.doc' if sending a DOC file
   $g = new G();
   $pathToFile = PATH_DOCUMENT . $g->getPathFromUID(@@APPLICATION) . PATH_SEP . 'outdocs' .
      PATH_SEP . $fileId . '_' . $aDocInfo['DOC_VERSION'] . $ext;
   $filename = $aDocInfo['APP_DOC_FILENAME'] . $ext;
   $aAttachments = array(
      $filename => $pathToFile
   );
   $c = new Cases();
   $aUsers = $c->getUsersParticipatedInCase(@@APPLICATION);
   $to = '';
   foreach ($aUsers['array'] as $userUID => $userInfo) {
      $to .= (empty($to) ? '' : ', ') . $userInfo['USR_EMAIL'];
   }

   @@msg = PMFSendMessage(@@APPLICATION, '[email protected]', $to, '', '',
      'Document for case #'[email protected]@APP_NUMBER, 'caseInfo.html', array(), $aAttachments);	  
}
(31.49 KiB) Downloaded 180 times
By atuly7
#789140
amosbatto wrote:Yes, I made a mistake in the code I posted. This code should work. Also I have attached a sample process to test it.
Code: Select all
$docId = '689651513589ddf6adc5195091736966'; //set to the Output Document's unique ID
$caseId = @@APPLICATION;
PMFGenerateOutputDocument($docId);
$sql = "SELECT APP_DOC_UID FROM APP_DOCUMENT WHERE APP_UID='$caseId' AND DOC_UID='$docId'";
$aNewDoc = executeQuery($sql);

if (empty($aNewDoc)) {
   throw new Exception("Error: Unable to generate Output Document with ID '$docId'.");
}
else {	
   $fileId = $aNewDoc[1]['APP_DOC_UID'];
   $oDoc = new AppDocument();
   $aDocInfo = $oDoc->load($fileId);
   $ext = '.pdf';  //set to '.doc' if sending a DOC file
   $g = new G();
   $pathToFile = PATH_DOCUMENT . $g->getPathFromUID(@@APPLICATION) . PATH_SEP . 'outdocs' .
      PATH_SEP . $fileId . '_' . $aDocInfo['DOC_VERSION'] . $ext;
   $filename = $aDocInfo['APP_DOC_FILENAME'] . $ext;
   $aAttachments = array(
      $filename => $pathToFile
   );
   $c = new Cases();
   $aUsers = $c->getUsersParticipatedInCase(@@APPLICATION);
   $to = '';
   foreach ($aUsers['array'] as $userUID => $userInfo) {
      $to .= (empty($to) ? '' : ', ') . $userInfo['USR_EMAIL'];
   }

   @@msg = PMFSendMessage(@@APPLICATION, '[email protected]', $to, '', '',
      'Document for case #'[email protected]@APP_NUMBER, 'caseInfo.html', array(), $aAttachments);	  
}
1.png
1.png (148.03 KiB) Viewed 5672 times
Thanks amos. Your process is working. But using that trigger code users didn't get attached file even that trigger is not fired. I don't know the reason.
here is images of trigger and code of trigger and template.
Attachedmail.html
Code: Select all
Dear Participants,



Title: @@Title

Case @#APP_NUMBER is aproved & finalised.
Attached Financial Notification
Code: Select all
$docId = '75970458958995b9f6aab86009096404';
$subject = @@Title;
$caseId = @@APPLICATION;
PMFGenerateOutputDocument($docId);
$sql = "SELECT APP_DOC_UID FROM APP_DOCUMENT WHERE APP_UID='$caseId' AND DOC_UID='$docId'";
$aNewDoc = executeQuery($sql);

if (empty($aNewDoc)) {
   throw new Exception("Error: Unable to generate Output Document with ID '$docId'.");
}
else {   
   $fileId = $aNewDoc[1]['APP_DOC_UID'];
   $oDoc = new AppDocument();
   $aDocInfo = $oDoc->load($fileId);
   $ext = '.pdf';  //set to '.doc' if sending a DOC file
   $g = new G();
   $pathToFile = PATH_DOCUMENT . $g->getPathFromUID(@@APPLICATION) . PATH_SEP . 'outdocs' .
      PATH_SEP . $fileId . '_' . $aDocInfo['DOC_VERSION'] . $ext;
   $filename = $aDocInfo['APP_DOC_FILENAME'] . $ext;
   $aAttachments = array(
      $filename => $pathToFile
   );
   $c = new Cases();
   $aUsers = $c->getUsersParticipatedInCase(@@APPLICATION);
   $to = '';
   foreach ($aUsers['array'] as $userUID => $userInfo) {
      $to .= (empty($to) ? '' : ', ') . $userInfo['USR_EMAIL'];
   }

   @@msg = PMFSendMessage(@@APPLICATION, [email protected]', $to, '', '',
      $subject, 'Attachedmail.html', array(), $aAttachments);     
}
Condition for financial
Code: Select all
(@@secondApprovalCount==0 and @@decision4==1 and @@controllerCount==0 and @@app_s==1)
Attached Non Financial Notification
Code: Select all
$docId = '96578979458995b9f6afb04041036087';
$subject = @@Title;
$caseId = @@APPLICATION;
PMFGenerateOutputDocument($docId);
$sql = "SELECT APP_DOC_UID FROM APP_DOCUMENT WHERE APP_UID='$caseId' AND DOC_UID='$docId'";
$aNewDoc = executeQuery($sql);

if (empty($aNewDoc)) {
   throw new Exception("Error: Unable to generate Output Document with ID '$docId'.");
}
else {   
   $fileId = $aNewDoc[1]['APP_DOC_UID'];
   $oDoc = new AppDocument();
   $aDocInfo = $oDoc->load($fileId);
   $ext = '.pdf';  //set to '.doc' if sending a DOC file
   $g = new G();
   $pathToFile = PATH_DOCUMENT . $g->getPathFromUID(@@APPLICATION) . PATH_SEP . 'outdocs' .
      PATH_SEP . $fileId . '_' . $aDocInfo['DOC_VERSION'] . $ext;
   $filename = $aDocInfo['APP_DOC_FILENAME'] . $ext;
   $aAttachments = array(
      $filename => $pathToFile
   );
   $c = new Cases();
   $aUsers = $c->getUsersParticipatedInCase(@@APPLICATION);
   $to = '';
   foreach ($aUsers['array'] as $userUID => $userInfo) {
      $to .= (empty($to) ? '' : ', ') . $userInfo['USR_EMAIL'];
   }

   @@msg = PMFSendMessage(@@APPLICATION, [email protected]', $to, '', '',
      $subject, 'Attachedmail.html', array(), $aAttachments);     
}
Condition of Non Financial
Code: Select all
(@@secondApprovalCount==0 and @@decision4==1 and @@controllerCount==0 and @@app_s==0)
User only gets Approved Notification email if (@@secondApprovalCount==0 and @@decision4==1 and @@controllerCount==0)
Because of this trigger, attached file trigger is not fired?

Thanks & Regards
Attachments
2.png
2.png (144.9 KiB) Viewed 5672 times
User avatar
By amosbatto
#789141
You need to enclose your from email address in single quotation marks:
Change:
Code: Select all
   @@msg = PMFSendMessage(@@APPLICATION, [email protected]', $to, '', '',
To:
Code: Select all
   @@msg = PMFSendMessage(@@APPLICATION, '[email protected]', $to, '', '',
If it still doesn't work, make sure that [email protected] is the default account configured under Admin > Email Servers or it might get rejected as spam by the email server at sbicaps.com.
By atuly7
#789160
amosbatto wrote:You need to enclose your from email address in single quotation marks:
Change:
Code: Select all
   @@msg = PMFSendMessage(@@APPLICATION, [email protected]', $to, '', '',
To:
Code: Select all
   @@msg = PMFSendMessage(@@APPLICATION, '[email protected]', $to, '', '',
If it still doesn't work, make sure that [email protected] is the default account configured under Admin > Email Servers or it might get rejected as spam by the email server at sbicaps.com.
Now it is working. But it sends .bin file in attachment.
Here is screen shot.
Attachments
3.png
3.png (37.08 KiB) Viewed 5668 times
By atuly7
#789174
zainab wrote:Hello,

When you open the attachment, does the correct file open?
I checked it. I downloaded that file and changed extension of it. It gives expected output document. But it didn't add last approver's record in output document. So, Do I need to change triggers position and assign triggers in After Routing? Here is screen shot.
I want only .pdf extension for attached file.
Attachments
4.png
4.png (72.74 KiB) Viewed 5653 times
By mishika
#789198
Hello atuly7,

Kindly please export the current process, which includes the latest modifications and triggers.
This will help us debug the problem.

Best Regards
Mishika
By atuly7
#789201
mishika wrote:Hello atuly7,

Kindly please export the current process, which includes the latest modifications and triggers.
This will help us debug the problem.

Best Regards
Mishika
Please find attachment Downloads.zip. In that you will process as well as table schema.
In that process, there are 2 problems one is email attachment file is .bin extension and another is controller record didn't add in output document.
If user selects 2 approvers i.e. first and second approver then second approver record is added to output document. But when user selects 3 approvers i.e first, second approver and controller then in output document controller record is not added.

Thanks & Regards
Attachments
(101.72 KiB) Downloaded 105 times
By mishika
#789204
Hello,

In all the tasks, where the output document is being generated from the @=gridVar1 variable you need to do the following changes:
1. place the trigger that is assigning the value to @=gridVar1 after dynaform
2. place the trigger that generates the output document from @=gridVar1 after routing of that task.

This will solve the issue that one entry was missing in the output document.

For the attachment to be sent via mail, in the definition of the corresponding Output Document make the changes:
1. Report Generator from HTML2PDF to TCPDF
2. Output Document to generate from Both to Pdf.

This worked for me and I got an output document attached in my email with an extension .pdf
Please try this and let us know if this works.

Hope this helps

Best Regards
Mishika
By atuly7
#789216
mishika wrote:Hello,

In all the tasks, where the output document is being generated from the @=gridVar1 variable you need to do the following changes:
1. place the trigger that is assigning the value to @=gridVar1 after dynaform
2. place the trigger that generates the output document from @=gridVar1 after routing of that task.

This will solve the issue that one entry was missing in the output document.

For the attachment to be sent via mail, in the definition of the corresponding Output Document make the changes:
1. Report Generator from HTML2PDF to TCPDF
2. Output Document to generate from Both to Pdf.

This worked for me and I got an output document attached in my email with an extension .pdf
Please try this and let us know if this works.

Hope this helps

Best Regards
Mishika
Thanks for reply.
First one is working. But second one i.e. change in output document is not working. I mean it worked in my pc (windows 8 ). If I export my process in other which has windows 10 in that it didn't work. It didn't show grid values in output document if Report generator is TCPDF. If I changed it to HTML2PDF then it shows that grid values in output document. Is it because of windows 10?

Thanks & Regards
By FreddyBernal
#825947
Hi,
I get this error when the trigger fires:
Captura.JPG
Captura.JPG (53.14 KiB) Viewed 195 times
If I show the path is empty

The trigger code is:

$docId = '8940746045d4c4f8c63e680065920017'; //set to the Output Document's unique ID
$caseId = @@APPLICATION;
PMFGenerateOutputDocument($docId);
$sql = "SELECT DISTINCT APP_DOC_UID FROM APP_DOCUMENT WHERE APP_UID='$caseId' AND DOC_UID='$docId'";
$aNewDoc = executeQuery($sql);

if (empty($aNewDoc)) {
throw new Exception("Error: Unable to generate Output Document with ID '$docId'.");
}
else {
$fileId = $aNewDoc[1]['APP_DOC_UID'];
$oDoc = new AppDocument();
$aDocInfo = $oDoc->load($fileId);
$ext = '.pdf'; //set to '.doc' if sending a DOC file
$g = new G();
$pathToFile = PATH_DOCUMENT . $g->getPathFromUID(@@APPLICATION) . PATH_SEP . 'outdocs' .
PATH_SEP . @@Placa .
PATH_SEP . $fileId . '_' . $aDocInfo['DOC_VERSION'] . $ext;
$filename = $aDocInfo['APP_DOC_FILENAME'] . $ext;
$aAttachments = array(
$filename => $pathToFile
);
$c = new Cases();
$aUsers = $c->getUsersParticipatedInCase(@@APPLICATION);
$to = '';//@@APPLICANT_EMAIL;
foreach ($aUsers['array'] as $userUID => $userInfo) {
$to .= (empty($to) ? '' : ', ') . $userInfo['USR_EMAIL'];
}

@@msg = PMFSendMessage(@@APPLICATION, '[email protected]', $to, '', '',
'Documento de aprobación consumo interno #'[email protected]@APP_NUMBER, 'caseInfo.html', array(), $aAttachments);
}

What can I do?

Thanks
By FreddyBernal
#825950
Hi,
I put a second trigger:
Code: Select all
//set to the Output Document definition's unique ID:
$outDocDef = "8940746045d4c4f8c63e680065920017";
$caseUID = @@APPLICATION; //Unique ID for the current case
$aAttachFiles = array();

$outDocQuery = "SELECT AD.APP_DOC_UID, AD.DOC_VERSION, C.CON_VALUE AS FILENAME
   FROM APP_DOCUMENT AD, CONTENT C
   WHERE AD.APP_UID='$caseUID' AND AD.DOC_UID='$outDocDef' AND
   AD.APP_DOC_STATUS='ACTIVE' AND AD.APP_DOC_UID = C.CON_ID AND
   C.CON_CATEGORY = 'APP_DOC_FILENAME' AND AD.DOC_VERSION = C.CON_PARENT
   ORDER BY AD.DOC_VERSION DESC";

$outDoc = executeQuery($outDocQuery);

if (!empty($outDoc)) {
   $g = new G();
   $path = PATH_DOCUMENT . $g->getPathFromUID($caseUID) . PATH_SEP . 'outdocs'. PATH_SEP .
      $outDoc[1]['APP_DOC_UID'] . '_' . $outDoc[1]['DOC_VERSION'];
   $filename = $outDoc[1]['FILENAME'];
   $aAttachFiles[$filename . '.pdf'] = $path . '.pdf';  //remove if not generating a PDF file
	//@@Link = $path . '.pdf';
  
}

$usr = userInfo(@@USER_LOGGED);
$from = "[email protected]"; //set to the email account set in Admin > Email Servers
//$usr['mail']
@@Link = @@APPLICANT_EMAIL;
@@resp=PMFSendMessage(@@APPLICATION, $from, @@APPLICANT_EMAIL, "", "",
   "Consumo interno para el vehículo " . @@Placa, "caseReportTemplate.html", array(), $aAttachFiles);
It executes whitout errors but dont send the email.
The file exists, the email adress are correct but mail dont are send.

What can I do?

Thanks
User avatar
By amosbatto
#825957
Do you have template file in your process named "caseReportTemplate.html"?
When you run the case with Debug Mode activated, what is the value of the "resp" variable?

Change your code to:
$outDoc = executeQuery($outDocQuery);
@=outDocs = $outDoc;

Then, check whether the database query found the Output Document file in the Debugger. If it didn't, then check whether $outDocDef is set to the ID of the Output Document.

If you can't figure it out, export your process and post your .pmx file.
User avatar
By amosbatto
#825958
FreddyBernal wrote: Tue Aug 13, 2019 8:49 am Hi,
I get this error when the trigger fires:
In your php.ini file, you need to have the following settings:
Code: Select all
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT 
display_errors = Off
Remember to restart Apache or reboot after changing your php.ini file.
User avatar
By amosbatto
#825984
FreddyBernal wrote: Wed Aug 14, 2019 8:38 am Two triggerd are working :D
But, the attached file is .bin if I download the file and rename it is ok.
What can i do?
Are you using version 3.3.1 or later?
If so, then you need to add this line to your env.ini file:
files_white_list="bin"
See: https://wiki.processmaker.com/3.3/Compa ... Extensions
By FreddyBernal
#826000
Hi,
The file attached is .pdf, but the mail has a .bin file (is a .pdf but send as .bin).
What can i do?
Captura de Pantalla 2019-08-15 a la(s) 2.18.51 p. m..png
Captura de Pantalla 2019-08-15 a la(s) 2.18.51 p. m..png (400.69 KiB) Viewed 73 times
Regards
User avatar
By amosbatto
#826016
I suspect that the " (double quotation marks) in the Output Document's filename is causing problems. Change the variable in your Output Document definition from @@variable to @#variable so that it won't add double quotation marks to the filename.

If that isn't the problem, then in your trigger code, change from:
Code: Select all
@@resp=PMFSendMessage(@@APPLICATION, $from, @@APPLICANT_EMAIL, "", "",
   "Consumo interno para el vehículo " . @@Placa, "caseReportTemplate.html", array(), $aAttachFiles);
To:
Code: Select all
@=attachments = $aAttachFiles;
@@resp=PMFSendMessage(@@APPLICATION, $from, @@APPLICANT_EMAIL, "", "",
   "Consumo interno para el vehículo " . @@Placa, "caseReportTemplate.html", array(), $aAttachFiles);
Then, run a case and post a screen shot of your attachments variable in the debugger.

Hi, I want to have some of my workflows to be avai[…]

Hi Support, I think this is good. I too have fixe[…]

Hi, I'm facing the same error and when I run : […]

Routing Logic

Hi All I am doing a process, where i have 3 tasks […]