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.
Creating an Apex Action Type in Process Builder
To use this class in Process Builder, follow these steps as highlighted below:
- Go to Setup | Create | Workflows Approvals | Process Builder, and Create a New Process and click Add Action.
- Select Action Type as Apex. Enter Action Name. This is your way of identifying the action in the list of actions.
- Create an Action Name. This name should describe the action that takes place but should not be more than a few words.
- Select Create an AdvoDoc as the 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.
- 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. (Required)
- 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. (Required)
- 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. (Optional)
- Select Save.