mscrm-addons.com - Blog

IMPORTANT INFORMATION

This blog is deprecated since July 2020.The articles below are no longer maintained and might contain outdated information. 
You can find the most acutal and relevenat information in our Knowledge Base at support.mscrm-addons.com

News.mscrm-addons.com Blog

rss

Hello and welcome to our blog! What can we do for you? Are you looking for further technical information or step-by-step instructions to our products? Or would you like to read the latest news on mscrm-addons? Please feel free to browse our blog for detailed information and to share our posts!


If/else-conditions in *.docx templates

It is often required to place conditional fields within a template like e.g. only print address lines when stored in the regarding CRM-record.

Syntax

The syntax needed is pretty simple:

{if”<>”=”XY”Content if condition is fulfilled” “Content if condition is not fulfilled}

while the yellow part marks the condition, the green part marks the content that will be printed if the conditions is fulfilled and the red part marks the content that is printed if the condition is not met.


Please note
: The {} (brackets) are not just simple standard wavy-brackets but field-functions of MS Word and have to be inserted by pressing Ctrl+F9 or via Insert-> Quick-parts-> Field and selecting if.

By default, field functions are not shown within MS Word. To switch views, you can simply press Alt + F9.

 

Examples 

Printing a gender-specific salutation:
Dear {if”<<salutation>>”=”Mr.” “Mister” “Misses”} <<lastname>>

Showing fields only if available within CRM :
{if”<<emailaddress1>>”<>”” “Email: <<emailaddress1>>” “”<emailaddress1> }
{if”<<mobilephone>>”<>”” “<<mobilephone>>”}

This examples can also be found in the document attached to this article.

 

Common problems

  • Field – code brackets cannot be inserted inside a content control, so please ensure that the content control of the CRM-field you are using is not marked when trying to insert the {}-brackets.
  • For some reasons it is not possible to insert the brackets even outside the content-controls once there is nothing else than the content-control in the whole line. To overcome this issue you can simply insert any text or a space after or before the field and than insert the {} brackets.


    the {} cannot be inserted in the upper line of this picture without placing any kind of text. In the second line a space has been inserted after the name-field.

Helpful link:

http://office.microsoft.com/en-us/word-help/insert-and-format-field-codes-in-word-2010-HA101830917.aspx

if_example.docx (23.89 kb)

Please note: If you want to use money-fields in if-statements please change the type of the CRM field in the field properties.

Figure 1: Field properties - change type

 

That’s it! We appreciate your feedback! Please share your thoughts by sending an email to support@mscrm-addons.com.




Comments are closed.