1. Creating a Doc Config. #
- The Doc Config should have the ‘Main Word Document’ record type.

- In the created Doc Config, enter the document title. It will be the name of the generated document.

- Link Data Sources to the Doc Config.
FYI: You can link only Data Sources of type ‘Single sObject’

- Prepare a Word document with merge fields.The merge fields will retrieve data from the Web Form that you submit.
You can see an example of a document with merge fields below.

- Go to the Pdf Butler.
- Click ‘Open PDF Butler’ in Doc Config.


- Next, add the Data Sources and select the Config Type.


- Example of an added Data Config.

- Add the prepared document with the same merge fields.
Note: The Data Config must contain the same fields that were added to the document. Only this document will be included as the After Action document.
- Click Choose File and attach the document.

- Once the document is added, click the ‘Save to Server’ button.

- The system should save without errors.

2. Flow Configuration #
There are three available types in the Flow: Files, Text, and Redirection URL.
- Set the value in Assign After-Action Type to Files, for example:

- Add the ID of the Doc Config. This should be the Doc Config with the ‘Main Word Document’ record type that was created and configured earlier.


- Save the Flow as a new version and activate it.
3. Creating a Web Form #
- Go to the Web Form Editor and add the same fields that are used in the document to the form. Then save the form.

- Go to the Doc Config and first create an Unattached Form Request.

- Once the Unattached Form is created, enter the API name of the Flow in the ‘After Action’ field on the Form Request.

- Open the Form Request link, enter some data, and click ‘Submit Form’.

- You can download the files.


- Create Request from Account.

Note: If it is an Unattached Form, the file will be attached to the Form Request.
If the Web Form is created from an Account (for example), the file will be attached to the Account.


Account:

4. Redirection URL #
- Go to the Flow and change the type to Redirection URL.

- Add New Variable ‘redirectionURL’.

- Save the Flow as a new version and activate it.
Create an Unattached or Attached Form Request and submit the form.
After submission, you will see the redirection message.

- The user should be redirected to the site specified in the Flow.

5. Text #
- Add a new resource – Variable – in the Flow.
- Set the following values:
- API Name: message
- Data Type: Text
- Available for Output: True
- Enter the text you want to display after submitting the form in the Default Value field.

- Save the Flow as a new version and activate it.
- Create an Unattached or Attached Form, enter the data, and submit the form.

Note: If you use the Redirection URL or Message type, after submitting the form, the file will be attached to the Form Request (if it is an Unattached Form) or to the Account (if it is an Attached Form).
6. Form #
- Create Assignment


- Set Data Source Assignment
Value = id of Data source Account - Create Variable ‘valuesDataSource’


- Loop updatable.


- Create Variable.


- Create dataSourceData.




- Create an Apex Action.
- Set the Doc Config ID to the Doc Config with the ‘Main Word Document’ record type.

















































