Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Conditional statement in CRM Word template based on field value

(1) ShareShare
ReportReport
Posted on by

I am having a problem with word templates.

First I created CRM document template and then I added required fields from XML Mapping Pane as Content Controls (plain text).

Then I created a rule inside a Word template to only show field if it contains a value, and if it is empty to hide it

{ IF <<field_name>> <>"" <<field_name>> }

This is working just fine.

Now I want to create a new conditional rule inside a Word template which is based on field value – if a CRM field value is equal to 24 months then write text 24 months, else write text unlimited.

{IF <<duration>> = ”24 months” “24 months” “unlimited”}

I don’t know if there is some syntax problem with my conditional statement, but this is not working. 

Does anyone have an idea how to solve this?

*This post is locked for comments

  • tomasipaolo Profile Picture
    10 on at
    Conditional statement in CRM Word template based on field value
    Frankly I find it ridiculous that there is no answer by Microsoft after 6 years, and even more ridiculous that such basic functionality is absent from Word templates in Dynamics 365. For Jove's sake, it was possible to do these things easily on the Psion 3mx organizer in 1995!
  • JohnKoso Profile Picture
    5 on at
    RE: Conditional statement in CRM Word template based on field value

    Has anyone found an solution?

  • Jindrich Simacek Profile Picture
    25 on at
    RE: Conditional statement in CRM Word template based on field value

    Hi all,

    I'm having exactly the same problem. I'd need to display different String in the Word template based on an option set value.

    Was anyone able to successfully use an IF conditional statement in Dynamics Word Template?

    I've gone through the tutorial from Milan but I'm always getting the false value form this condition although it should return true.

    {IF <<payabledays>>="0" "Text1" "Text2 <<payabledays>>" \*MERGEFORMAT}

  • Community Member Profile Picture
    on at
    RE: Conditional statement in CRM Word template based on field value

    zzecevic and WNC_Paul,

    thanks for your replies.

    I noticed a few older answers on this forum where people wrote that it is not possible to use conditional statements in Word templates and that toggling visibility based on a field values is also a limitation.

    I was wondering if something in the meantime has changed.

    I found one great tutorial on how to use conditional text in word:

    support.clio.com/.../204459577-Tutorial-Using-Conditional-Text-in-Document-Automation

    Is it possible to achieve this with Dynamics CRM Word templates?

  • Community Member Profile Picture
    on at
    RE: Conditional statement in CRM Word template based on field value

    I had a similar problem myself with our Word templates. We wanted large sections of text to either show or not show depending on values from the CRM fields, which also included other CRM field values.

    I didn't find a proper solution but got it working by creating extra hidden fields on the CRM form and using Javascript to fill those depending on the values I wanted for the template.

    It's probably a bad way to do it, but it is working for us and the Word template is looking how the people want it to.

  • zzecevic Profile Picture
    on at
    RE: Conditional statement in CRM Word template based on field value

    Hi Milan, 

    I am having the same problem. I can get option set value if the field is outside conditional sentence, but in it I always get false value.

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 Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans