Conditional Logic in Microsoft Word Documents (DOCX)
Conditional logic allows you to create multiple variations of a document all in one template. Any sections/lines/paragraphs of the document can be made conditional based on the value of a field in your Lawmatics CRM. This is particularly useful for automating your documents, so that you do not need to take the time to make nit-picky changes to each client's document, the template will simply make those changes for you automatically.
Just like you are used to with our start fresh document editor, it is simple to create DOCX documents with dynamic data, changing depending on the value of certain fields. While the start fresh editor is a bit more simple to use, creating a DOCX template is useful for more highly formatted/designed documents, since it will preserve your formatting from Word.
Before moving forward with conditional logic, make sure you are familiar with using merge fields in DOCX documents.
To build conditional logic into your document you will need to use our conditional field language in your Word document. This will be simple to use once you get the hang of it, but keep in mind you will need to get things just right in order for the logic to work properly.
Remember that all of these edits will need to take place in your Microsoft Word document before uploading it to Lawmatics.
Using IF, THEN statements
The first thing to know about setting conditional logic in a DOCX document is that you can only use true/false fields (AKA boolean) or picklist type fields to set conditional logic. This means that you can not use an open text field to set conditions. Only fields that have defined responses can be used for setting conditional logic. You also cannot use a multi-picklist field to set conditional logic.
Below is an example of how conditional logic is built in your Word templates. This example uses the field practice_area, but note that you can do conditional logic with any field.
{{#practice_area == Family Law}}We look forward to handling your Family Law matter.{{/practice_area}}{{#practice_area == Estate Planning}} We look forward to handling your Estate Planning matter.{{/practice_area}}
Let's break this down.
You can see that all information contained inside the {{}} brackets is meant to be Lawmatics "code". Information inside these brackets will be evaluated as fields or conditions in the document.
You will need to use information inside brackets to set the IF statement for the conditional logic, then include the text of your conditional THEN statement, and lastly you will use another set of brackets to signify where the THEN statement ends.
The first line {{#practice_area == Family Law}} is what sets the first IF condition. Note that the bracketed line must be placed on its own line of text.
The text after these brackets "We look forward to handling your Family Law matter." is your THEN statement.
The following brackets, {{/practice_area}}, tell the system where the THEN statement ends. Notice that this text is also on its own line.
So, IF the practice area is Family Law, THEN this statement will be shown in the document. If the condition is met, then any text before the closing brackets, {{/practice_area}}, will be used.
We've also added a second condition to the example above. Immediately following the close of the first THEN statement, there is a second IF condition for if the practice area is estate planning, coded as such: {{#practice_area == Estate Planning}}
We then have our THEN statement for this IF condition, "We look forward to handling your Estate Planning matter.", and lastly we have closed the statement with one more closing bracket: {{/practice_area}}
So in this example, if the practice area is family law then the first sentence is shown, and if the practice area is estate planning the second sentence will be used.
This example uses the field practice_area, but note that you can create a conditional IF statement with any field.
To create an if condition you must place the condition within double brackets, {{}}. Then, inside the brackets, start with a "#" immediately followed by the field code, which again is obtained from the DOCX Field Reference mentioned above.
You will then place a space after the field code, followed by two equal signs == and another space, and then put the value of the field that will set the IF condition. Then close the brackets.
After this opening condition, you can type all the text you would like. Then, close the IF statement with another set of double brackets, then use / immediately followed by the same field code. Not the value of the field, just the field code name.
You can create multiple if statements for the same field, enabling you to create options for each value of a field, just as demonstrated in the practice area example above.
Using IF NOT, THEN Statements
It is also possible to create an IF NOT statement. In order to accomplish this, simply use "^" in place of "#". So, for example, the following would represent text to be used if the practice area WAS NOT Estate Planning:
{{^practice_area == Estate Planning}}We look forward to handling your matter that is not Estate Planning.{{/practice_area}}