I am trying to create a conditional statement for the marketing email. The statement should show text based on TWO FIELDS on the contact. I keep getting the same syntax error and I am lost here.
The fields on the contact are
Communication Salutation is a custom field - option set that has the values:
The statement is the following:
show:
Sehr geehrter Herr {{contact.lastname}}
else:
show:
Lieber {{contact.firstname}}
The same will be applied to the Female.
The statement:
{{#if (eq contact.gendercode 1)}}{{#if (eq contact.new_Communicationsalutation 100.000.000)}}Sehr geehrter Herr {{contact.lastname}}{{/if}}{{/if}}
{{#if (eq contact.gendercode 1)}} {{#if (ne contact.new_Communicationsalutation 100.000.000)}}Lieber {{contact.firstname}}{{/if}}{{/if}}
{{#if (eq contact.gendercode 2)}} {{#if (eq contact.new_Communicationsalutation 100.000.000)}}Sehr geehrte Frau {{contact.lastname}}{{/if}}{{/if}}
{{#if (eq contact.gendercode 2)}} {{#if (eq contact.new_Communicationsalutation 100.000.000)}}Liebe {{contact.firstname}}{{/if}}{{/if}}
Error: Dynamic content contains a syntax error (such as a missing curly bracket) in or near the following code: {{#if (eq contact.new_Communicationsalutation 100.000.000)}}Sehr geehrter Herr {{contact.lastname}}{{/i.
https://docs.microsoft.com/en-us/dynamics365/marketing/dynamic-email-content#conditional-statements-and-comparisons - this is what I used to create the statements:
What am I doing wrong?
There could be a few reasons as of why this happens:
I usually solve these issues by starting out very small and see when the error occurs.
For example, try (in a new email):
{{contact.new_Communicationsalutation}}
Does this give any errors? If not, proceed with the following statement and only after that try to add the if-statements.
Hope this helps!
I did try it and this is the error:
Have you tried removing the dots in your option set value? Although the system shows option set values with dots, they are stored without them in the database.
{{#if (eq contact.new_Communicationsalutation 100000000)}}
André Arnaud de Cal...
291,979
Super User 2025 Season 1
Martin Dráb
230,848
Most Valuable Professional
nmaenpaa
101,156