Introduction
In the 15.5 release of Nintex Drawloop DocGen for Salesforce, we introduced new components for DocGen and Salesforce Admins to configure automatic docgen runs using Process Builder (PB) or Flow. In order to use the components for either PB or Flow, you will need to need to have the "Automated DocGen" addon for your subscription.
Creating a Process Builder work to generate documents
A button-click is the most common way Drawloop is used to generate document outputs. This method requires a Salesforce user to login to Salesforce, navigate to a record where a majority of the data is held and select a URL button if you’re using the Classic SFDC interface or through a run component if you’re users are in Lightning. But this process is not the only way Drawloop can generate outputs. Drawloop has always offered its customers the ability to have event-driven outputs through Salesforce workflow rules and apex triggers. This requires a custom field formula field, an outbound message and a workflow rule to get everything to work properly for the former and apex code for the latter. But now that process builder is enhancing event driven triggers in Salesforce, Drawloop has added an action that will allow its customers to replicate this experience directly in process builder through a point-and-click interface. Which will remove the need for a workflow rule, outbound message, custom formula field or code. Instead providing a clean and easy UI to build event driven document generation.
To get started, one just needs to start process builder and decide where they want document generation to occur. This will differ for each customer. The process builder UI can be accessed in the Salesforce setup console. If you don’t already have a process that you’re working on, you can start a new process by clicking the ‘New’ button in the ‘My Process’ view.
When you’re starting a new process, you’ll need to decide what object to tie your process to. This should coincide with the object your DocGen package is tied to as a record type. If you do not have a DocGen package at this point, you can reference how to make one here:
Modify your flow to have all non-related DocGen actions as necessary. Once you are ready to include document generation in your process, setup the logic needed to that will lead to document generation. This can be the creation of a record, or a record being modified to meet a certain criteria. This logic is will differ from customer to customer.
Prior to setting up the DocGen action in process builder, you’ll need to retrieve two IDs from the DocGen package that will be used in the process action. You’ll need to capture the record ID for both the DocGen Package itself and the Delivery Option that you want to use when the action is called upon. The best deliveries for an automated process are Email, Attaching back to Salesforce, Document Queue and e-Signature. The IDs for both the DocGen package and Delivery Option can be copied from the end of the URL when you navigate to each record.
Once the IDs are gathered, they can be used in the action. When configuring an action in process builder, you must select ‘Apex’ as the action type. There should then be an option for ‘Run DocGen Package’ available in the Apex Class dropdown after the action type is selected. From there, you can set the fields for ‘DocGen Package ID’ and ‘Delivery Option ID’ by pasting the copied record IDs into the ‘value’ column. The last Field you’ll want to configure is the ‘Record ID’ which will be a field reference to the record you are going to run the document for.
Once all of this is setup, you just need to activate the process and you will have event-based document generation with Drawloop.
Note: Because the IDs in process builder will be static, you’ll want to update the IDs whenever a process is change-set from one Salesforce environment to another. You’ll have to repeat the process of gathering the new ID from the migrated DocGen package and Delivery Option.