Announcement

Collapse
No announcement yet.

Using templates when sending mail

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

  • Using templates when sending mail

    Hi,

    In the workflow part, I send an e-mail using the formula below, but only variable names appear in the e-mail. The variable values in the template do not appear, but there is no problem with the variables in the pdf file.

    My second question is that the workflow sends this email 2 times in a row, each time?

    Thanks.

    HTML Code:
    $attachmentId = ext\pdf\generate(
    'Szlemeler', entity\attribute('id'), '5fdf90b38f5836c38', 'test.pdf'
    );
    
    $emailId = record\create('Email',
    'to', entity\attribute('emailAddress'),
    'attachmentsIds', list($attachmentId)
    );
    
    // applying email template
    ext\email\applyTemplate($emailId, '5fdf91f92471e807e');
    
    ext\email\send($emailId);
    Attached Files
    Last edited by serqet; 12-20-2020, 06:52 PM.

  • #2
    Does anyone have an idea about this?
    Maximus
    yuri

    Comment


    • #3
      Hello serqet,
      When you applying an email template you need to specify the parentType and parentId parameters.
      For example:
      Code:
      $attachmentId = ext\pdf\generate( 'Szlemeler', entity\attribute('id'), '5fdf90b38f5836c38', 'test.pdf' );
      
      $emailId = record\create('Email',
      'to', entity\attribute('emailAddress'),
      'attachmentsIds', list($attachmentId),
      [COLOR=#2ecc71]'parentType', 'Szlemeler',
      'parentId', id[/COLOR]
      );
      
      // applying email template
      ext\email\applyTemplate($emailId, '5fdf91f92471e807e');
      ext\email\send($emailId);

      Comment


      • #4
        Thanks Maximus it worked now seems to be values. So how can you help my second question?

        My second question is that the workflow sends this email 2 times in a row, each time?

        Comment


        • #5
          You have the scheduled workflow that runs as many times as many records are matched by your linked report.
          In case it sents emails twice for each recipient each time the workflow is triggered, you need to check whether there are no duplicated records matched by the report.

          Comment


          • #6
            Maximus Only 1 record appears in the target report and I don't have a similar workflow?

            Comment


            • #7
              Maximus It seems to run only 1 time in workflow logs. 1 in 5 minutes

              Click image for larger version

Name:	workflow.png
Views:	472
Size:	12.1 KB
ID:	65841

              Comment


              • #8
                Originally posted by Maximus View Post
                You have the scheduled workflow that runs as many times as many records are matched by your linked report.
                In case it sents emails twice for each recipient each time the workflow is triggered, you need to check whether there are no duplicated records matched by the report.
                I guess because I used the formula with the update target record, it sends 2 duplicate mails. yuri help please.
                Click image for larger version

Name:	fetch?id=65714.png
Views:	545
Size:	36.0 KB
ID:	65850

                Comment


                • #9
                  I solved the problem using BPM.

                  Comment

                  Working...
                  X