Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

marketing email - use #each and #if

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

  • Suggested answer
    Vinayd-MSFT Profile Picture
    Vinayd-MSFT Microsoft Employee on at
    RE: marketing email - use #each and #if

    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?

  • slx Profile Picture
    slx 386 on at
    RE: marketing email - use #each and #if

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

    (not clear if it can be done)

  • Suggested answer
    Naveen Ganeshe Profile Picture
    Naveen Ganeshe 3,393 User Group Leader on at
    RE: marketing email - use #each and #if

    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

  • Suggested answer
    Vinayd-MSFT Profile Picture
    Vinayd-MSFT Microsoft Employee on at
    RE: marketing email - use #each and #if

    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.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans