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

Announcements

No record found.

News and Announcements icon
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

  • 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
    Microsoft Employee on at
  • 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Syed Aqib Raza Profile Picture

Syed Aqib Raza 102

#2
11manish Profile Picture

11manish 88 Super User 2026 Season 2

#3
ParthPatel249 Profile Picture

ParthPatel249 84

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans