web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Conditional statements and comparisons

(0) ShareShare
ReportReport
Posted on by 70

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

  1. gendercode: Male (value: 1) and Female (value:2)
  2. new_Communicationsalutation: Formal and Informal

Communication Salutation is a custom field - option set that has the values: 

  • formal (value: 100.000.000)
  • informal (value: 100.000.001)

The statement is the following:

  • If contact is Male
  • If contact has a formal communication salutation

show:

Sehr geehrter Herr {{contact.lastname}}

else:

  • If contact is Male
  • If contact has INFORMAL communication salutation

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: 

  • {{#if A}}{{#if B}}<DisplayedContent>{{/if}}{{/if}}

What am I doing wrong?

I have the same question (0)
  • kevin_scx Profile Picture
    45 on at

    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)}}

  • kovinina Profile Picture
    70 on at

    I did try it and this is the error:

    2021_2D00_08_2D00_01-15_5F00_58_5F00_40_2D00_Marketing-Email_5F00_-Designer_5F00_-Email-3ka-_2800_Blank_2900_-_2D00_-Dynamics-365.png

  • Suggested answer
    kevin_scx Profile Picture
    45 on at

    There could be a few reasons as of why this happens:

    • The option set value is not valid
    • The capital at the beginning of the schema name is not valid
    • You are using an invalid relationship or one that has not been added to the marketing service yet

    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!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 197 Super User 2026 Season 1

#2
CU11031447-0 Profile Picture

CU11031447-0 100

#3
NeerajPawar Profile Picture

NeerajPawar 70

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans