Microsoft introduced the CRM Word Templates feature, in Dynamics CRM version 2016. Using Word Templates, users can insert fields from CRM records in a Word document. The feature stops here.
With Dynamics PDF-Docs (click here to download trial version) users can, in one click, PDF the generated Word Document, attach it to Notes, Email or upload the document to SharePoint location or add documents from SharePoint as attachments to Email workflow, together with the PDF generated with Word Template.
What if you need these features, not available with CRM "Word Templates"?
Keeping rich text formatted fields in CRM, after they are inserted to the document. In current version of Word Templates, formatting is lost in the document, and comes up as one long line of text.
Your document requires logical operations like hide or display text based on the content of a field in CRM record. As an example, you wish to hide / Display the table header “Discount” for invoices, quotes and similar documents, generated for clients not entitled for discount.
OR you need the feature of inserting fields from CRM records into Word document, and the CRM version installed on your server is previous to 2016 release?
Well before Microsoft released version 2016, Dynamics Objects developed “Dynamics Docs” to perform these much needed functionalities, for all CRM versions. (Dynamics Docs, can be downloaded here).
Same as with Dynamics PDF-Docs, with one click you can PDF the generated documents, attach the PDF file to Notes, Email and upload the document to SharePoint or attach documents from SharePoint to Email workflow
Returning to our topic, the issue with Rich Text was explained and resolved in previous post:
In this post I will show how text can be hidden or displayed, based on selected option in the CRM record. Consider a letter, sent from the local library, which only one of the 2 below, mutually exclusive lines (in bold letters), can be displayed:
======================================================
Dear <<ClientName>>
Thank you for your Email received yesterday.
I wish to confirm the following:
Your current borrowing entitlements are <<books>> books per month
Your video entitlements are <<video>> per year
If the above is incorrect, don’t hesitate contacting me
Words between << and >> symbols, are placeholders and are automatically replaced with the field content they are linked to. We wish to display one of the above lines, based on the selected option either Books or Videos of the Type field of the entity.
First step is to create the document text as variable, by making it a placeholder. As spaces are not allowed in placeholder, and still keep the variable name easily recognized, we use exact same text, but without spaces:
After importing the Word document with all variables set as placeholders, click the Add Fields to Template. In this example we demonstrate the hide/ display of the first line, the second line setting is very similar to the first one.
Select the Merge Tag: <<Yourcurrentborrowingentitlementsare>> the related entity is Library and the condition is on the option selected in the Type attribute.
Insert Expression. If Books=Books then the Special Text = Your current borrowing entitlements are
Otherwise = blank
Similar condition applies to the placeholder <<bookspermonth>>
Select the Merge Tag: <<bookspermonth>> the related entity is Library and the condition is on the option selected in the Type attribute.
Insert Expression. If Books=Books then the Special Text = books per month
Otherwise = blank
Don’t forget that the <<books>> placeholder is a number and you need to add condition to hide it as well. The expression is:
If Type=books then Books (the attribute Books of the entity) Otherwise=Blank
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.