Announcement

Collapse
No announcement yet.

Email Gets Stuck in Draft - Process Flowchart

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Email Gets Stuck in Draft - Process Flowchart

    I'm trying to send emails automatically using process flowcharts in Advanced Pack 2.10.0.

    Instead of being sent automatically, the email gets stuck in the user's draft email folder.

    The following script is executed as a Script Task in the flowchart.

    $emailId = record\create('Email',
    'to', entity\attribute('emailAddress'),
    'from', entity\attribute('userStaffAssign.emailAddress'),
    'status', 'Sending',
    'attachmentsIds', list($attachmentId),
    'parentType', 'Lead',
    'parentId', entity\attribute('id')
    );
    ext\email\applyTemplate($emailId, '616774f38a63217db');
    ext\email\send($emailId);

    The email template and the attachment both work properly. But the email is not sent unless the user goes to the draft email folder and manually sends it.

    Can anyone see what I'm doing wrong?

    Using Espo version 7.1.7 with Advanced Pack 2.10.0.

  • #2
    Hi showard,

    Please try to change status Sendind to Draft in your formula.

    Comment


    • #3
      Thanks for responding.

      I have tried using both 'Draft' and 'Sending' as the status.
      I tried removing the attachment, just in case it was causing some kind of conflict.
      I tried sending without applying the email template.

      Each time it ends up in the Drafts folder.

      Comment


      • #4
        I don't know if this helps or makes it more confusing, but this script previously worked fine in the older Advanced Pack version 1.34.0 with Espo v. 5.9.4.

        Comment


        • #5
          Hi,

          first change this :
          entity\attribute('userStaffAssign.emailAddress')
          to something : $fromEmailAddress = record\attribute('User', $assignedUserId, 'emailAddress');
          so you get emailAddress of the User
          no need to set status


          $emailId = record\create('Email',
          'to', entity\attribute('emailAddress'),
          'from', $fromEmailAddress,
          'attachmentsIds', list($attachmentId),
          'parentType', 'Lead',
          'parentId', entity\attribute('id')
          );
          ext\email\applyTemplate($emailId, '616774f38a63217db');
          ext\email\send($emailId);

          i think you have 2 problem :
          fromAddress and status

          Comment


          • #6
            Thanks - I tried both of those fixes, and it still gets stuck in the draft folder.

            Also tried, 'from', 'person@domainname.com', but still with the same results.

            The template and the attachment both work; the to and from addresses are correct. But the user still has to manually send it from their drafts folder.

            Comment

            Working...
            X