Creating an AdvoDoc Document Via the Process Builder

The following technique has been developed to provide organizations with the ability to automatically create a document from within the Process Builder.

Use the following custom Apex Class to facilitate using the Process Builder.

AdvoLogix AdvoDoc Apex Class

The following Apex method can be used to create an AdvoDoc document via Process Builder.

Apex Class Name:
DocumentService


Parameters:

@recordId
Required. The Id value of the base object's source record for which AdvoDoc should be generated for.

@templateId
Required. The AdvoDoc Template Id to be used for merging with the source record to create the new document.

@outputformat
Optional. The output format is either PDF or DOCX. This is an optional parameter and if not provided, the API function will default to the value provided on the AdvoDoc Template. If the template format is not specified the defaulted format will be PDF.

Creating an Apex Action Type in Process Builder

To use this class in Process Builder, follow these steps as highlighted below:

  1. Go to Setup | Create | Workflows  Approvals | Process Builder, and Create a New Process and click Add Action.

  2. Select Action Type as Apex. Enter Action Name. This is your way of identifying the action in the list of actions.

  3. Select DocumentService as Apex Class. Two parameters are automatically added to Set Apex Variables section. One optional parameter to override Template output Format can be added by clicking Add Row.

  4. Enter the field name of the Record ID field. This will normally be the Matter ID field but could also be the Contact or Account ID field name.

  5. Enter the record ID of the AdvoDoc Template you wish to instantiate with this Action. This button allows toggling between Text Entry or using the Field Picker.

  6.  Click Save.