With our Word filler template feature it is possible to automatically fill in Word documents based on the input given by the creator and receiver of the flow. This manual explains how to add paragraphs to the Word document based on conditions.
This manual discusses advanced settings of the Word fill feature. It is important that before continuing with this manual, that you have mastered the topics discussed in this manual: Word fill part 1. How to pre-fill Word documents based on Flow responds
The Word fill feature is only applicable for flows made in the Studio. This manual will consist of 2 steps. Follow each step in the presented order.
Step 1. Create the Word document and add the condition
For this example Paragraph X should be displayed when the contact answers A to question 1, and Paragraph Y should be displayed when the contact answers B to question 1.
In the Word document:
- Add Paragraph X and Paragraph y to the Word document
- Above each paragraph note down the following: {#variable_name=="answer_value"}
- For which # notes a condition
- For which variable_name is the name assigned to question 1
- For which == stands for equals to
- "answer_value" stands for the out come to question 1
- Below Each paragraph note down the following: {/}
- {/} marks where the paragraph ends
The word document will look like this:
Different operators:
Equals: {#variable_name == "answer_value"}
Inequality: {#variable_name != "answer_value"}
Or: {#variable_name_1=="answer_value" || #variable_name_2!="answer_value}
And: {#variable_name_1=="answer_value" && #variable_name_2!="answer_value}
Step 2. Add the download element to your flow, upload the Word document and edit the element in script mode.
After uploading the Word document in the Download Element:
- Open the File Download element by clicking on it.
- Click on the center-column's right corner on Script
- Around line 17 you will find the code "fill": { }
- In between the curly brackets of "fill"{ } define the variable name and to which key it is assigned to as this: "variable_name": "{element_key}",
End result
When the contact opens the flow, fills it in, and clicks on download your Word document will appear with the prefilled information based on the conditions.