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

Community site session details

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

Categories:
  • Suggested answer
    Vinayd-MSFT Profile Picture
    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
    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
    3,392 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
    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

Community Spotlight of the Month

Kudos to Mohamed Amine Mahmoudi!

Blog subscriptions now enabled!

Follow your favorite blogs

TechTalk: How Dataverse and Microsoft Fabric powers ...

Explore the latest advancements in data export and integration within ...

Leaderboard > Customer Insights - Journeys

Featured topics

Product updates

Dynamics 365 release plans