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, should be displayed (in bold letters)
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 Books or Video of the Type field of the entity:
First step is to create the document text as variable, by making it a placeholder. As placeholder, spaces are not allowed, and to make the variable easily recognizable, we use exact same text, but without spaces:
<<Yourcurrentborrowingentitlementsare>> <<books>> <<bookspermonth>>
<<Yourvideoentitlementsare>> <<video>> <<per year>>
After importing the Word document with all variable content 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