CMS Development

Antoine_AR
Member

If statement with personalization token on email

SOLVE

Hello,

 

I am trying to show some text depending on the value of a contact property display through a personnalization token.

 

I tried to use if statement, but it doesn't work. I do not have the correct content in my email.

I even tried the unless statement, but I had no result either.

 

To give you some context : When a user complete a form, I retrieve all data from this form. Then I use a worflow to send an email with the data I retrieved.

What I'm trying to do is, when a user do not enter an optionnal field in the form, then in the content's email has to change depending on these optionnal field.

 

Here is the code I'm using to test it (when a value = "Select", it means that the user didn't fill an optionnal field) :

 

<table style="background-color: white; padding: 32px 24px;">
  <tr>
    {% if contact.form__experience_1 ==  "Select" %}
    <td>
      {% inline_rich_text field="content_2" value="{{ module.content_2 }}" %}
    </td>
    {% else if contact.form__experience_2 ==  "Select"  %}
    <td>
      {% inline_rich_text field="content_3" value="{{ module.content_3 }}" %}
    </td>
    {% else if contact.form__experience_3 ==  "Select" %}
    <td>
      {% inline_rich_text field="content_4" value="{{ module.content_4 }}" %}
    </td>
    {% else %}
    <td>
      {% inline_rich_text field="content_1" value="{{ module.content_1 }}" %}
    </td>
    {% endif %}
  </tr>
</table>

 

I hope we can find a solution for this issue.

Don't hesitate to tell me if you need more information.

 

Thank you,

Antoine

0 Upvotes
1 Accepted solution
Mark_Ryba
Solution
Contributor | Elite Partner
Contributor | Elite Partner

If statement with personalization token on email

SOLVE

Hey @Antoine_AR, I would review this documentation to make sure you're using the "programmable email beta" correctly, which should have no problem working with the code you provided.

 

Additionally, just based on my previous experience, I would add a short delay step in your workflow (a couple of minutes) before the email is sent, just in case any data is slow to update in the CRM which could lead to inaccurate logic cases or value displays.

View solution in original post

2 Replies 2
Mark_Ryba
Solution
Contributor | Elite Partner
Contributor | Elite Partner

If statement with personalization token on email

SOLVE

Hey @Antoine_AR, I would review this documentation to make sure you're using the "programmable email beta" correctly, which should have no problem working with the code you provided.

 

Additionally, just based on my previous experience, I would add a short delay step in your workflow (a couple of minutes) before the email is sent, just in case any data is slow to update in the CRM which could lead to inaccurate logic cases or value displays.

dennisedson
Community Manager
Community Manager

If statement with personalization token on email

SOLVE

@Mark_Ryba , @Chris-M 

How would you all go about solving this?

Thanks,

Dennis




HubSpot Community Developer ShowMake sure to subscribe to our YouTube channel
where you can find the HubSpot Community Developer Show
0 Upvotes