The Flow Builder in Salesforce is a great tool change up your document generation experience. Our DocGen for Salesforce product has two actions that can be used in the Flow Builder:
- Preview Component
- Apex Action
The difference between the two is that Preview Component will generate a document on screen like a manual push. The Apex Action will run in programmatically so the user will not visibly see the generation occur. The preview component will be what we will be focusing for this blog.
I like to use the preview component in scenarios when the lightning component is not able to capture the experience I want before the generation occurs. One common use case I get brought is users being able to make changes to the document before the document generates. We understand there are scenarios where we want the users to make the changes to the document directly, however you are also risking your users to generate documents without knowing what they are inputting into the document. The Flow Builder can create an experience where they are able to make a change in certain parts without them directly making changes in your document as well as tracking what the user has inputted.
In your Flow Builder, create a screen flow. Have a text component added to your screen.
![](https://uploads-us-west-2.insided.com/nintex-us/attachment/bee08dcd-faf7-4758-80cd-1b8e6a8be5a6.png)
The next action can either be creating a record if you have a child object you want to track it like a list, or just update the record that you are generating the document from.
![](https://uploads-us-west-2.insided.com/nintex-us/attachment/6b968e26-9c6c-46dc-be33-9e58d002951a.png)
Create another screen and add the “Preview DocGen” component.
![](https://uploads-us-west-2.insided.com/nintex-us/attachment/657a1313-7435-4513-91db-7a178bb432d2.png)
This is not an additional feature you have to install as this comes withy our package when you install our package. If you do not see this component, you may need to update your package from the AppExchange. The preview component mainly looks for three things for it to work:
- Record Id (insert the record ID variable)
- DocGen Package Id
- Delivery Option ID
The ID’s of the DocGen Package and the delivery option can be found on the metadata dropdown on the DocGen Package.
![](https://uploads-us-west-2.insided.com/nintex-us/attachment/300f5a02-b9e2-42ed-b162-ea04250c4137.png)
You can add additional parameters such as the Contact ID as well as any attachment IDS. (note: currently other parameters are not supported). The document will then generate based on the package ID and the delivery method that you have specified. Please note, some delivery methods such as email will need “auto send” turned on the delivery option for this to work. You can see what the latest supported method for the delivery option here.
Once this is all configured, your users can now add comments during their document generation process:
![](https://uploads-us-west-2.insided.com/nintex-us/attachment/68bc25b9-b8f8-4d58-94f8-8d6c3dab7cfc.png)
You’ll see the DocGen Package run once the user gets to this screen.
![](https://uploads-us-west-2.insided.com/nintex-us/attachment/7bc8b914-7a09-4135-9798-ca3e5cb3b85e.png)
The updated information will also appear on the document as well as being tracked in Salesforce.
![](https://uploads-us-west-2.insided.com/nintex-us/attachment/1a6e287f-74f7-4caa-98f7-c7aa4ea91f02.png)
![](https://uploads-us-west-2.insided.com/nintex-us/attachment/0a61af98-b2f5-4724-82bd-773b1b261f6b.png)