Skip to main content

Notifications

Announcements

No record found.

Customer Insights - Journeys forum
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

Categories:
  • 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 Moderator 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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,570 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,683 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans