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

IF statement comparing two fields

(0) ShareShare
ReportReport
Posted on by 47

Hi all,

I'm inputting an if statement into my email but want to compare the value of one field to another in the system, whilst I get no errors when setting the logic up, the output is blank in tests where it should be showing the information. The below is an example of the code I'm using. Is there a way to make this work, or is it impossible to compare the values in two fields and only show dynamic content if they match?

{{#if ( eq contact.A contact.B)}}
    THIS IS A TEST
{{/if}}

Thanks, Charlie

I have the same question (0)
  • Josh - Microchannel Profile Picture
    45 on at

    Hey Charlie,
    This is perfectly valid logic. I also created a test scenario setting both the contacts first name and last name as the same value and using the following statement to display text if they match.

    {{#if (eq contact.firstname contact.lastname)}}
    You have a match!
    {{/if}}

    "You have a match!" only displays when the two fields have an exact match. This is also case sensitive.

    Please check the fields are of the same data type and you are using the field logical name.

    Looking forward to hearing how you go.

    All the best,
    Josh

  • Suggested answer
    Josh - Microchannel Profile Picture
    45 on at

    Hey Charlie,

    This is perfectly valid logic. I also created a test scenario setting both the contacts first name and last name as the same value and using the following statement to display text if they match.

    {{#if (eq contact.firstname contact.lastname)}}
    You have a match!
    {{/if}}

    "You have a match!" only displays when the two fields have an exact match. This is also case sensitive.

    Please check the fields are of the same data type and you are using the field logical name.

    Looking forward to hearing how you go.

    All the best,
    Josh

  • Leco Lv Profile Picture
    on at

    Hi partner,

    Josh is right. it is possible. hope this link helps you.

    https://docs.microsoft.com/en-us/dynamics365/marketing/dynamic-email-content#conditional-statements-and-comparisons

  • slx Profile Picture
    386 on at

    thank you, do you know if you can search and compare values in an array/iteration [tag:each] ?

    example [tag:each] returning 3 values, compare array[0] with array[1]

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 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

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

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans