Force.com Actions Developer Guide
User Manual:
Open the PDF directly: View PDF .
Page Count: 27
Force.com Actions Developer
Guide
Developer Guide
Version 39.0, Spring ’17
@salesforcedocs
Last updated: March 16, 2017
© Copyright 2000–2017 salesforce.com, inc. All rights reserved. Salesforce is a registered trademark of salesforce.com, inc.,
as are other names and marks. Other marks appearing herein may be trademarks of their respective owners.
CONTENTS
Chapter 1: Introducing Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Invoking Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Available Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Chapter 2: Action Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Apex Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Email Alert Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Flow Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
PlatformAction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Post to Chatter Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Quick Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Refresh Metric Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Simple Email Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Submit for Approval Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
INDEX
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
CHAPTER 1
Introducing Actions
Use actions to add more functionality to your applications. Choose from standard actions, such as posting to Chatter or sending email,
or create actions based on your company’s needs.
For example, you can:
• Add features and functionality to your existing Force.com tools.
• Build dynamic modules for Force.com development into your enterprise integration tools.
• Build specialized development tools for a specific application or service.
You can batch actions to improve performance in API version 35.0 and later.
Overview
Actions allow you to build custom development tools for Force.com applications.
Actions are about “getting things done” in Salesforce. They encapsulate a piece of logic that allows a user to perform some work, such
as sending email. When an action runs, it saves changes in your organization by updating the database.
Actions are easy to discover and use, and also easy to understand and implement. Every button and link in Salesforce can be considered
an action. A consistent Actions API and framework support the creation and distributed use of actions throughout Salesforce. Actions
are available in the REST API.
The types of actions are:
Type
Description
InvocableAction
Invocable actions, also known as dynamic actions, can be invoked from a common endpoint in the
REST API. They provide “describe” support – a programmatic mechanism to learn about all invocable
actions on the platform.
There are two types of invocable actions.
Standard action
A standard action is ready to use right away. The work it performs is predefined, along with its
inputs and outputs, and they’re available in every organization.
Custom action
You create custom actions because these actions require a definition. For example, to use an
Apex action, create the Apex class method for the action.
QuickAction
Quick Actions, formerly known as Publisher Actions, use page layouts to make it easy for administrators
to configure an action to create or update a record. The API always works with an sObject.
StandardButton
Standard buttons are URLs allowing users to either go to another page (for example, the Edit page)
or accomplish some task (for example, lead conversion).
1
Introducing Actions
Invoking Actions
Type
Description
CustomButton
Custom buttons are URLs that an administrator can specify and when included on a page and clicked,
will redirect a user to that URL.
To call an action from a flow, use FlowActionCall, as described in the Metadata API Developer’s Guide.
The If-Modified-Since header can be used with actions, with a date format of EEE, dd MMM yyyy HH:mm:ss z.
When this header is used, if the action metadata has not changed since the provided date, a 304 Not Modified status code is
returned, with no response body.
Invoking Actions
All actions are invoked using the same JSON body format. The top-level JSON key name must be inputs.
The following example request shows two Chatter posts made with a single Post to Chatter action.
POST /vXX.X/actions/standard/chatterPost
{ "inputs" :
[
{
"subjectNameOrId" : "jsmith@salesforce.com",
"type" : "user",
"text" : "first chatter post!"
},
{
"subjectNameOrId" : "hsmith@salesforce.com",
"type" : "user",
"text" : "second chatter post!"
}
]
}
Here is the response.
[ {
"actionName" : "chatterPost",
"errors" : null,
"isSuccess" : true,
"outputValues" : {
"feedItemId" : "0D5D0000000kynqKBA"
}
}, {
"actionName" : "chatterPost",
"errors" : null,
"isSuccess" : true,
"outputValues" : {
"feedItemId" : "0D5D0000000kynrKBz"
}
} ]
Standard actions return their name in actionName. The value of actionName varies for custom actions.
2
Introducing Actions
Available Actions
Action
actionName value
Flow
The flow name
Apex
The class’s invocable method name
Quick action
Source Exif Data:
File Type : PDF
File Type Extension : pdf
MIME Type : application/pdf
PDF Version : 1.4
Linearized : Yes
Create Date : 2017:03:16 22:08:45Z
Author : salesforce.com, inc.
Date Time Generated : 2017-03-16T15:08:37.691-07:00
Trapped : False
DRC : 206.14
Modify Date : 2017:03:16 22:08:45Z
Format : application/pdf
Title : Force.com Actions Developer Guide
Creator : salesforce.com, inc.
Producer : XEP 4.20 build 20120720
Creator Tool : Unknown
Page Count : 27
Page Mode : UseOutlines
EXIF Metadata provided by EXIF.tools