Action Plans helps your organization encapsulate best practices into easily sharable, reusable task templates.
You can create Action Plans for the following objects:
Action Plans is unsupported. For community assistance with Action Plans, please visit Salesforce Trailblazer Community. To submit ideas or issues, please visit Action Plans on Github.
Action Plans is open source software. We welcome your issue reports, ideas, documentation, code tweaks and all other participation. Learn more.
Getting started is easy. For each object, you need to add a button to the list view, add a button to the detail page. For Accounts, follow these steps:"
Change these setting by editing Action Plan Settings, and updating values at either the organization level, profile levels, or user levels.
Navigate to Setup > Develop > Custom Settings. Click on 'Manage' next to Action Plans Settings
. Click the 'New' button near 'Default Organizational Level Value'. Check the values that you want to enable.
Enable Chatter Post
places a post in the related record's Chatter Feed (if Chatter is enabled for that object). If unchecked, Action Plans does not create a Feed Post.Unassigned Task Defaults to Record Owner
ensures that Action Plan Template tasks with a blank 'Assigned To' field go to the related record's owner. If unchecked, tasks with a blank 'Assigned To' field are assigned to the running user. Tasks can be assigned to specific people on Action Plan Templates, which overrides this setting.Default Object on Lead Conversion
specifies that if an Action Plan is related to a Lead, whether the Action Plan should be moved to the converted Account, Contact, or Opportunity when the Lead is converted. The default is Contact.Action Plans Business Hours ID
and Use Business Hours
are reserved for future functionality.Modify Custom Metadata Weekend Day
to indicate which days of the week are the weekend and how many days to move a task forward or backwards to move it to the end of the previous week or the start of the next week. This allows you to work with a different weekend, or to avoid assigning any task to be due on any specific day of the week.
All weekdays should have 0 in both numeric fields.
For each object, you need to add a button to the list view, For Accounts, follow these steps:
Repeat these steps for the other standard objects Action Plans supports: Contacts, Leads, Opportunities, etc.
Follow this steps for Action Plan Object:
Optionally, add the "Action Plan Task" field to your Task page layout, but it should be Read-Only, as clearing this field will break the ability to track Action Plan progress.
Action Plans includes two shareable objects: Action Plan
and Action Plan Template
. You may configure your sharing settings in whatever way works for your organization.
Tasks
. They can be assigned Tasks without knowing that these Tasks are part of an Action Plan. Any changes they make to a Task's Status will be reflected in the related Action Plan Task Template record automatically. No Permission Set is required.Assign the appropriate Permission Set(s) to each user who will need to use Action Plans:
Action Plans Admin:
Full permissions for Action Plans, Action Plan Templates, AP Tasks and APT Task Templates.Action Plans Template Creator:
Full permissions for Action Plan Templates and AP Template Tasks. No Action Plan access.Action Plans Creator:
Read, Create, Edit, Delete for Action Plans and AP Tasks. Read-only for Action Plan Templates and APT Task Templates.Action Plans Import/Export:
Access to export and import Action Plan Template records. View the appropriate button for export and tab for import.Action Plans User:
Read-only for Action Plans and AP Tasks. Edit permission for Tasks should be provided via the user's profile or other permission sets.Uses for each Permission Set:
Action Plans User
Permission Set. It gives Read-only access to Action Plan.Action Plans Creator
Permission Set gives read-only access to Action Plan Templates, and Read, Create, Edit, and Delete access to Action Plans.Action Plans Template Creator
Permission Set. This includes permission to Read, Create, Edit, and Delete all Action Plan Templates only. It does not include any Action Plan or Task permissions. If these users require Action Plan access, other Permission Sets should be used as well. A custom permission allows exporting of Action Plan Templates.Action Plans Template Creator
, the Action Plans Import/Export
permission set allows the viewing of the Export button on Template detail pages and to the Import tab. The custom permission Action Plan Template Export
allows exporting of Action Plan Templates and associated tasks. Use this permission with care, as it is a potential security hole for your org's proprietary templates. This is a great way to move templates from a Sandbox to Production org.Action Plans Admin
includes Modify All permissions for all four Action Plan objects (Action Plan, Action Plan Task Template, Action Plan Template, and Action Plan Template Task Template). The custom permission allows exporting Action Plan Templates.Note: The Apex used in Flows or via triggers does not require special permissions to run.
MyObject__c
, you must name the field on Action Plan MyObject__c
Related Objects
fieldset on Action Plan.before delete
and after undelete
contexts (removing the LabsActionPlans
namespace if you're not using the managed package):
LabsActionPlans.ActionPlansTriggerHandlers.actionPlansSObjectTriggerHandler( 'CustomObject__c' );
Don't forget to write a test class to cover the custom object trigger. If you're just going for coverage (not a best-practice!) just make a test method inserting and then deleting a record. Unfortunately, the code in this package does not lend itself to easy creation of an Action Plan for a custom object... yet.
Create Custom Object Action Plan
button to the Action Plan objectWhile Action Plans already overrides the New Action Plan action, the New button will show a new Action Plan screen, but will not allow adding an existing template. (Perhaps this will be in a future release... safe harbor.) Create a custom button with the following format on the Action Plan object and add it to the related list on the custom object page layout:
LabsActionPlans__
namespace if you're not using the managed package):
{!URLFOR( $Action.LabsActionPlans__ActionPlan__c.New, null, [refType="CustomObject__c", refId=CustomObject__c.Id] )}
Create Action Plans
for multiple Custom Object recordsJust as there is a button for Account list views to create multiple Action Plans, you can do the same for your custom object. Create a Visualforce page with the following code:
<apex:page standardController="CustomObject__c" recordsetvar="o"
extensions="LabsActionPlans.ActionPlansCreateMultipleAPsExtension"
showHeader="false" action="{!doRedirect}">
<apex:form>
<apex:actionFunction name="jsCancel" action="{!cancel}" immediate="true" />
</apex:form>
<script>
var oids = '{!JSENCODE(objIDs)}';
if (oids.length < 15) {
alert('{!$Label.LabsActionPlans__ap_Errors_selectOneRecord}');
jsCancel();
}
</script>
</apex:page>
Then create a list view button for that object and add it to your list views.
If you want, for example, not to allow relating Action Plans to Contracts, remove the Contract field from the Action Plan Related Objects fieldset. There is no need to delete the field from the Action Plan object.
Now you're ready to create your first template. Navigate to the Action Plans Templates tab. Click on the "New Action Plan Template" button.
The template screen looks like this:
Name - Template Name.
Description - An explanation of how the template should be used.
Skip Weekends - Allows you to automatically reschedule a task that would fall on a weekend to either the day before or day after the weekend. When checked, a picklist appears, allowing you to select before or after the weekend.
Action - Click "X" to eliminate a step in a template.
Subject - What the task is to do.
Task Dependency - The dependent task will only be created once the controlling task is completed.
Days After- This value determines the due date of the task.
Assigned To - Looks up to user. Leave blank if you want to assign the task dynamically. When assigning dynamically, the default behavior will be to assign the task to the running user. You can also have the system assign it to the record owner by changing your Action Plan Settings. See "Post Install Configuration" guide above.
Category - What type of activity.
Priority - Taken from Task priorities and Record Type (if applicable).
Email - Send a standard New Task email when checked. For Tasks depending on others, the email will be sent when the task is created.
Reminder - This check box will define the default behaviour for reminders when applying the template to create an Action plan .
If it's left unchecked, in the Action Plan Creation page the reminders will be initially disabled
If it's checked the reminders will be available.
Comments - Comments supporting a task.
Add New Task - Adds an additional row to the tasks grid.
Save - Saves the template.
If your org uses Task Record Types, you must specify which Record Type to use for all Tasks from each Action Plan and Template record. This will affect the Status values available for each related Action Plan Task. This cannot be changed once an Action Plan or Template is created. Only one record type may be specified for all the Tasks on that Action Plan or Template.
Navigate to an Accounts list view. Select the Accounts for which you want to create Action Plans. Click on the "Create Account Action Plans" button.
Select the template you want to use by typing the name on the lookup and clicking on it.
Enter the information specific to this plan. Note that the Accounts you selected earlier are visible.
Save the Action Plan. Note: Action Plan creation is handled by a queueable (asynchronous) process. It can take a couple of minutes to be able to view all created records.
Verify the Action Plan and the tasks.
Complete the first task on the Action Plan. Note that the Action Plan is now in the correct related list and that this Account has one open activity and one closed activity. The third activity in the template is dependent and will be created only when its controlling task is complete. (A Contact related list is shown here, but this applies equally to Accounts.)
To receive Task notifications if Send Email
is selected on an Action Plan Task, ensure that users have been allowed to control receipt of Task notification emails (this is active by default), and that they have allowed email notifications to be sent (this is also enabled by default). See Salesforce H&T for more information.
The Send Email
field on Action Plan Task must be checked to send a email notifications, and the setting Allow Flow to send delegated task notifications on records created through Apex
must also be enabled. Go to Settings > Feature Settings > Sales > Activity Settings to check that box and allow email notifications to be sent via Flow-created Action Plans.
If the user has enabled task notification, then those will be sent when an Action Plan Task is created.
Send Email
box is NOT checked, the user may still receive a task notification if that is in their personal settings. Action Plan Tasks cannot be assigned to queues, so if the parent record is owned by a queue, each AP Task will be assigned to the running user. Tasks generated from that Action Plan can be assigned to the queue by using a Flow to reassign the Tasks. Because the Invocable Apex returns a list of Action Plan Task IDs, the created Tasks (which have a relationship to the Action Plan tasks) can be updated in that same flow, as they are created synchronously and can be queried immediately. Alternatively, reassign Tasks to Queues any other way you'd like; it will not break Action Plans, and the Queue name will show on the Action Plan detail page.
Action Plans includes an Invocable Apex class that can be included in a Flow. The Record ID of the triggering record is required, as is the Id OR the Name of the desired template. Days from trigger to start Action Plan is optional (and defaults to 0). The first task will be due the number of days (specified on the template) from the start date. This date may fall on a weekend, though task due dates can be moved to avoid weekends if set on the template.
The Invocable Apex class returns the Salesforce IDs of all the created Action Plan Tasks, which can be used in the next Flow steps.
Run the following:
sf apex run --file ./data/sample-data.apex
To use this Template with the included Flow, see the Create Action Plan From Template
Apex Action in the New Customer Onboarding Activities
Flow
Create an Account and set Type
to any value that starts with 'Customer'
It is recommended NOT to check the Recursion box when creating a Process Builder to work with Action Plans.
It is also recommended NOT to use Process Builder at all!
To call the invocable Apex from a Trigger or Apex class, adapt the following sample code:
String apTemplateName;
ActionPlanTemplate__c apTemplate;
List<SObject> toInsert... // can use any object, such as Account, or the generic SObject class
List<ActionPlanCreateInvocable.CreateActionPlanRequest> requests = new List<ActionPlanCreateInvocable.CreateActionPlanRequest>();
for(SObject a : toInsert){
ActionPlanCreateInvocable.CreateActionPlanRequest req = new ActionPlanCreateInvocable.CreateActionPlanRequest();
req.templateNameOrID = apTemplate.Id;
req.relatedRecordID = a.Id;
req.daysToActionPlanStart = 0;
req.actionPlanName = a.Name + ' - Onboarding';
requests.add(req);
}
List<Id> resultIDs = ActionPlanCreateInvocable.makeActionPlanFromTemplate(requests);
String apTemplateName;
LabsActionPlans__ActionPlanTemplate__c apTemplate;
List<SObject> toInsert... // can use any object, such as Account, or the generic SObject class
List<LabsActionPlans.ActionPlanCreateInvocable.CreateActionPlanRequest> requests = new List<LabsActionPlans.ActionPlanCreateInvocable.CreateActionPlanRequest>();
for(SObject a : toInsert){
LabsActionPlans.ActionPlanCreateInvocable.CreateActionPlanRequest req = new LabsActionPlans.ActionPlanCreateInvocable.CreateActionPlanRequest();
req.templateNameOrID = apTemplateName;
req.relatedRecordID = a.Id;
req.daysToActionPlanStart = 1;
req.actionPlanName = a.Name + ' - Onboarding';
requests.add(req);
}
List<Id> resultIDs = LabsActionPlans.ActionPlanCreateInvocable.makeActionPlanFromTemplate(requests);
Variables:
templateNameOrID
(required) Name is not unique, so ID is preferredrelatedRecordID
(required) Must have a relationship field named the related record object name from Action Plan objectdaysToActionPlanStart
(not required) Defaults to 0, the day the plan is createdactionPlanName
(not required) Give the Action Plan a custom name. If not specified, defaults to {Template Name} - {Parent Record Name}.Action Plans supports the sharing and discovery of best practices using Template Export and Template Import.
Export is simple. Navigate to the Template you wish to export. Click on the "Export" button.
Export creates a simple XML file containing template header and task information. It also includes information about who created the template. Note: It does not include user information or sensitive data about what objects you might use this template with.
If you are using Lightning Experience, the exported file is in your Files tab, in your private files library. If you are still using Salesforce Classic, it is in your Documents tab, in your private documents folder.
Sharing the file is easy. Email the file to whomever you want to share it with. Do you want to share it with a broader audience? Email the file to Salesforce Labs at labs@salesforce.com.
Import is also simple. Navigate to the "Import Template" tab. Select the file you want to import using "Browse" and once you've found it click on "Import Template."
This repository also includes sample Action Plan Template files, which you can import on the appropriate tab. You may download New Customer Onboarding or Trade Show Follow Up from GitHub, or you can find it in this SFDX project in the data
folder.