You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Handlebars conditional statements are not behaving the same way in the SendGrid Email Template Preview application (via https://mc.sendgrid.com/dynamic-templates/{id}) and the email that is delivered to the email inbox.
Expected Behaviour
The Handlebars logic should behave the same in the Email Preview app and in the Email that is generated by the SendGrid API
Steps to reproduce it
Create a minimal email template example with the following HTML + Handlebars markup:
<!doctype html>
<html>
<head></head>
<body>
Description: {{description}}<br/>
Old Description: {{description_old}}
<hr />
{{#if (notEqualsdescriptiondescription_old)}}
<p>"Descriptions are not equal"</p>
{{#if (notEqualsdescription"")}}
<p>"Description changed"</p>
{{else}}
<p>"Description removed"</p>
{{/if}}{{else}}
<p>"Description not changed"</p>
{{/if}}
</body>
</html>
and use the following JSON data to power the template:
{
"description_old": "This is my old description.",
"description": ""
}
LogCat for the issue
There are no errors reported anywhere. Only inconsistent Handlebars behaviors.
Screenshots of the issue
Example 1: Empty Description
{
"description_old": "This is my old description.",
"description": ""
}
I would expect the template to render that the descriptions are not equal and that the descriptions have changed, and this is what appears in the SendGrid Preview App, but in the actual email that is sent to the inbox, it says "Description changed" not the expected"Description removed"
Example 2: No change in description
{
"description_old": "This is my old description.",
"description": "This is my old description."
}
I would expect to see "Description not changed" in both places, but, the actual email thinks the descriptions are different, showing something different than the preview app:
Example 3: Changed description
{
"description_old": "This is my old description.",
"description": "This is a new description."
}
Here I expect to see "Description changed" in both places, and this time it works as expected in both places
Would you like to work on the issue?
I can of course try to help, but I honestly think this has nothing to do with the email-templates directly. My theory is that the problem is that the Handlebars logic is not the same in the preview app than it is on the SendGrid API.
Note that I was asked to open this issue on Github via SendGrid support ticket number 13993343
The text was updated successfully, but these errors were encountered:
my example does not show any coercion happening, I am comparing strings to strings, so I would expect that this statement from the docs does not apply in my usage example. Or am I wrong?
Actual Behaviour
The Handlebars conditional statements are not behaving the same way in the SendGrid Email Template Preview application (via
https://mc.sendgrid.com/dynamic-templates/{id}
) and the email that is delivered to the email inbox.Expected Behaviour
The Handlebars logic should behave the same in the Email Preview app and in the Email that is generated by the SendGrid API
Steps to reproduce it
Create a minimal email template example with the following HTML + Handlebars markup:
and use the following JSON data to power the template:
LogCat for the issue
There are no errors reported anywhere. Only inconsistent Handlebars behaviors.
Screenshots of the issue
Example 1: Empty Description
I would expect the template to render that the descriptions are not equal and that the descriptions have changed, and this is what appears in the SendGrid Preview App, but in the actual email that is sent to the inbox, it says
"Description changed"
not the expected"Description removed"
Example 2: No change in description
I would expect to see "Description not changed" in both places, but, the actual email thinks the descriptions are different, showing something different than the preview app:
Example 3: Changed description
Here I expect to see "Description changed" in both places, and this time it works as expected in both places
Would you like to work on the issue?
I can of course try to help, but I honestly think this has nothing to do with the email-templates directly. My theory is that the problem is that the Handlebars logic is not the same in the preview app than it is on the SendGrid API.
Note that I was asked to open this issue on Github via SendGrid support ticket number 13993343
The text was updated successfully, but these errors were encountered: