Announcement

Collapse
No announcement yet.

How do i get the email template ID in formula

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

  • How do i get the email template ID in formula

    Hi,

    I am trying to send an email using workflow "ext\email\applyTemplate(EMAIL_ID, EMAIL_TEMPLATE_ID, [PARENT_TYPE, PARENT_ID])​ "as follows:

    HTML Code:
    $emailId = record\create(
    'Email',
    'to', entity\attribute('emailAddress'),
    'parentType', 'Case'
    );
    ext\email\applyTemplate($emailId, 'auto-reply-for-admission');
    ext\email\send($emailId);​
    Its seems to work except that the email contents are empty. I am guessing it is because the email template id is wrong. The name is "Auto Reply for Admission". I tried all tricks but nothing works. How do i get email template id as the formula states? Also the email sent is not registered in Case's History or Stream.
    Last edited by murugappan; 01-22-2024, 06:14 AM.

  • #2
    Hi,

    Obtain a record ID from the address bar.

    Click image for larger version

Name:	image.png
Views:	68
Size:	19.7 KB
ID:	101818

    Comment


    • #3
      yuri ,

      Thank you so much the email was sent successfully. But the email is not logged into stream for the case or the history for the case. How can i achieve that?

      Comment


      • #4
        Hi murugappan,

        You should add parentId attribute (Case ID) to the following part of the formula script:
        Code:
        $emailId = record\create(
          'Email',
          'to', entity\attribute('emailAddress'),
          'parentType', 'Case'
        );​
        As a result, this part will look like this:​
        Code:
        $emailId = record\create(
          'Email',
          'to', entity\attribute('emailAddress'),
          'parentType', 'Case',
          'parentId', 'your-case-id'
        );​

        Thus, an email will be related to the required case.

        Comment


        • murugappan
          murugappan commented
          Editing a comment
          lazovic,

          Thank you for the update. It worked. In fact, i have extended the formula to include the "from" address as well.
      Working...
      X