Announcement

Collapse
No announcement yet.

Variables not appearing in template from workflow

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

  • Variables not appearing in template from workflow

    I have setup an email template that works if I manually choose it. It looks like this:

    Code:
    1
    
    title: {SalesOrder.name}
    
    2
    
    name: {SalesOrder.billingContact.name}
    
    3
    
    email: {SalesOrder.billingContact.emailAddress}
    
    4
    I then went to create a workflow to send this email and the PDF attachment of the Sales Order when the user changes the status to Active.

    I did this by putting the following Formula into a Workflow Condition:

    Code:
    $attachmentId = ext\pdf\generate(
    'Sales Order', entity\attribute('id'), '011', 'SalesOrder.pdf'
    );
    
    $emailId = record\create('Email',
    'to', 'randomsecret@robot.zapier.com',
    'attachmentsIds', list($attachmentId)
    );
    
    // applying email template
    ext\email\applyTemplate($emailId, '5f19c6ef603472375');
    
    ext\email\send($emailId);
    (On a side note, shouldn't this be the ACTION taken if the condition is met, not in the Conditions section?)

    Regardless, it does send an email - although it may be being triggered on every Update of the Sales Order because it's in the Condition section.

    The email however, does not replace the variables in the template when it sends. It has the {} tags instead of the Entity values that I would expect to show up.

    I must be missing something in how the variables get passed in?

    I also tried this same Formula by attaching it to the Entity itself with a conditional check on the status. Same issue happened. And this doesn't seem like it's smart to do there because it will send the email on every save if the status doesn't change.

    Any help is appreciated...

    -Eric

Working...
X