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 :
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

I have the same question (0)
  • 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#2
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans