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

Notifications

Announcements

No record found.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 185 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 110

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 69 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans