The following technique has been developed to provide organizations with the ability to instantiate a new Activity Plan from within the Process Builder.
Use the following custom Apex Class to facilitate using the Process Builder to create new Activity Plans for Matters, Accounts, Contacts and Other.
AdvoLogix Activity Plan Apex Class
Apex Class Name:
apProcessBuilder
Parameters:
@Activity Plan Template ID
The record ID of the Activity Plan Template to be used for the new Activity Plan.
@Source Record ID
The record ID field of the source object the new Activity Plan is being created for. This will be either the Matter, Account or Contact record ID field.
Creating an Apex Activity 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.
- Select apProcessBuilder as Apex Class. Two parameters are automatically added to Set Apex Variables section.
- Enter the record ID of the Activity Plan Template you wish to instantiate with this Action.
- Select Reference as the Field Type for the Source Record ID.
- Use the field selector to choose the field named Record ID. This will select the Matter, Account or Contact record ID field. Note you may quickly filter the field selection list by typing "record id".
- Click Save.