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

marketing email - use #each and #if

(0) ShareShare
ReportReport
Posted on by 386

Hi

Could you help how to insert #if in the statement below?

{{#each contact.msevtmgt_eventregistration_contact_msevtmgt_contactid}}

{{this.rbc_buildingcity}}

{{/each}}

For each statement if I want to add aditional: 

{{#each contact.msevtmgt_eventregistration_contact_msevtmgt_contactid}}

IF value = x THEN

{{this.rbc_buildingcity}}

ELSE

nothing

{{/each}}

Thank you

I have the same question (0)
  • Suggested answer
    Vinayd-MSFT Profile Picture
    Microsoft Employee on at

    What you have is almost correct - it should be #if (not IF), #else, and #endif. Also the condition "Value = x" needs to be written using this.xxx expression. See Add dynamic content to email messages (Dynamics 365 Marketing) | Microsoft Learn for syntax details.

  • Suggested answer
    Naveen Ganeshe Profile Picture
    3,397 User Group Leader on at

    Hi,

    Please take a look at the below thread. I believe these links may be helpful in your case.

    community.dynamics.com/.../advanced-custom-code-if-and-else-setting-in-a-marketing-email

    community.dynamics.com/.../foreach-loop-is-not-working-in-dynamic-content-marketing-email

  • slx Profile Picture
    386 on at

    Thank you, I've already added my question to both threads

    (not clear if it can be done)

  • Suggested answer
    Vinayd-MSFT Profile Picture
    Microsoft Employee on at

    Yes it can be done as long as "value = x" is written as an expression using "this" and follows the syntax provided in the documentation (link was provided in the earlier awnswer. Can you clarify what is the reamining question?

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 168 Super User 2026 Season 1

#2
NeerajPawar Profile Picture

NeerajPawar 65

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 51 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans