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.
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.
Create another screen and add the “Preview DocGen” component.
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.
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:
You’ll see the DocGen Package run once the user gets to this screen.
The updated information will also appear on the document as well as being tracked in Salesforce.