0

我们一直致力于使用 ProcessMaker 实施一些业务流程。我们一直在观察有关通过 ProcessMaker 发送电子邮件的附件的问题。

这里是详细的问题。

  1. 我们有一个计时器任务,它向业务用户发送一些电子邮件,其中包含一些由 PM 生成的附件。但我们一直观察到,有时发送的电子邮件没有附件,但有时电子邮件包含附件。

  2. 为了挖掘问题,我们在发送电子邮件之前检查了每个步骤,但我们发现在发送电子邮件之前存在附件文件。

  3. 在任何流程中,发送带有附件的电子邮件都可以正常工作。但是对于计时器任务,有时发送的电子邮件不带附件,有时发送的电子邮件不带附件。

  4. 以下是在定时器任务触发时执行的代码块。

    @%emailCounter++;
    
    try{
    
        $to = 'xxxx@gmail.com';
    
        $caseId = @@APPLICATION;
    
        $aAttachments = [];
    
        @@debugStr = "";
    
        @@fileQuery = "select `APP_DOC_UID`, `DOC_VERSION` FROM `APP_DOCUMENT` where `APP_UID`='$caseId' order by `DOC_VERSION` desc limit 1";
        $aFiles = executeQuery(@@fileQuery);
    
        @@debugStr .= ";<br/> File counts = ".count($aFiles);
    
        foreach ($aFiles as $aFile)
        {
            @@debugStr .= ";<br/> File = ".$aFile['APP_DOC_UID'];
    
            $oDoc = new AppDocument();
            $aDocInfo = $oDoc->Load($aFile['APP_DOC_UID'], $aFile['DOC_VERSION']);
    
            @@debugStr .= ";<br/> File Info = ".json_encode($aDocInfo);
    
            $ext = '.pdf';  //set to '.doc' if sending a DOC file
            $g = new G();
            $pathToFile = PATH_DOCUMENT . $g->getPathFromUID(@@APPLICATION) . PATH_SEP . 'outdocs' .  PATH_SEP . $aFile['APP_DOC_UID'] . '_' . $aDocInfo['DOC_VERSION'] . $ext;
            @@debugStr .= ";<br/> File path = ".$pathToFile;
            $filename = @@selfNamePDF;
    
            $aAttachments = PMFAddAttachmentToArray($aAttachments, $filename, $pathToFile);
    
        }
    
        @@subjectLine = '[Test - attachment] '.@@title;
    
        PMFSendMessage(@@APPLICATION, 'yyyy@zzz.com', $to , 'pppp@gmail.com','' , @@subjectLine, 'TestEmail.html', array(), $aAttachments);
    
    } catch (Exception $e) {
        PMFSendMessage(@@APPLICATION, 'yyyy@zzz.com', $to , 'mmmm@gmail.com','' , 'Exception Occured - '.$e->getMessage(), 'TestEmail.html', array(), $aAttachments);
    }
    

寻找一个我们可以认为摆脱这个问题的方向。

4

0 回答 0