CMS Development

Antoine_AR
Mitglied

If statement with personalization token on email

lösung

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 Akzeptierte Lösung
Mark_Ryba
Lösung
Mitwirkender/Mitwirkende | Elite Partner
Mitwirkender/Mitwirkende | Elite Partner

If statement with personalization token on email

lösung

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.

Lösung in ursprünglichem Beitrag anzeigen

2 Antworten
Mark_Ryba
Lösung
Mitwirkender/Mitwirkende | Elite Partner
Mitwirkender/Mitwirkende | Elite Partner

If statement with personalization token on email

lösung

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
HubSpot-Produktteam
HubSpot-Produktteam

If statement with personalization token on email

lösung

@Mark_Ryba , @Chris-M 

How would you all go about solving this?

0 Upvotes