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

I created a dynaform that will be accessed via Web Entry. The form contains three different file controls that I would like to send as attachments to the email. Once the form is submitted, two emails will be sent to two different groups.

I added the following trigger (which I plan to add twice based on another post that I saw in the forum). However it is not working.

I added the trigger to be sent Before Routing
Code: Select all
$aAttachFiles = array();
$caseId = @@APPLICATION;
$inDocUID = '6151910885a258489e120d5090840830'; // Input document UID
    $inDocQuery = "SELECT C.CON_VALUE AS FILENAME, AD.DOC_VERSION, AD.APP_DOC_UID, AD.DOC_UID 
                                FROM APP_DOCUMENT AD
                                JOIN CONTENT C
                                ON AD.APP_DOC_UID = C.CON_ID
                                WHERE AD.APP_UID = '".$caseId."' AND C.CON_CATEGORY = 'APP_DOC_FILENAME' AND AD.APP_DOC_TYPE = 'INPUT' AND AD.DOC_UID = '".$inDocUID."'";
    
    $inDoc = executeQuery($inDocQuery);

$g = new G();
if (is_array($inDoc)) {
    foreach ($inDoc as $doc) {
        $aAttachFiles[$doc['FILENAME']] = PATH_DOCUMENT . $g->getPathFromUID($caseId) . PATH_SEP .
        $doc['APP_DOC_UID'] . '_' . $doc['DOC_VERSION'] . '.' . pathinfo($doc['FILENAME'], PATHINFO_EXTENSION);
   }
}

PMFSendMessage($caseId, 'xxx@companyname.com', 'lena.thompson@companyname.com', '', '', 'Files', 'customerservice.html', '', $aAttachFiles); 
#813128
There is a bug with MultipleFile controls in Web Entry forms (which should get fixed in version 3.2.2), so you should only use File controls in Web Entry forms.

That trigger code should work as long as you have changed $inDocUID to match your Input Document UID. You also need to make sure that you have created a template file in your process named "customerservice" (the .html part will automatically be added when you create the file). Also make sure that the email xxx@companyname.com is the same email account that you have configured under Admin > Email Servers or most email providers (Gmail, Yahoo!, Hotmail, etc) will block it as spam. If you don't receive the email, you open the case and see if a record for the mail exists in the menu under Information > Messages History (or check in the APP_MESSAGES table in the database).

The next problem is that you can't fire a trigger immediately after a Web Entry form. The best you can do is set the trigger to fire before the first step in the first task in the process.
PS: If you want to immediately send the email after the Web Entry, then see this post:
viewtopic.php?f=41&t=713347

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[…]

Experience heightened pleasure with Cenforce 100 M[…]