Newer Version Available

This content describes an older version of this product. View Latest

PlatformAction

PlatformAction is a virtual read-only object. It enables you to query for actions displayed in the UI—such as standard and custom buttons, quick actions, and productivity actions—given a user, a context, device format, and a record ID.

Supported Calls

query()

Fields

Field Details
ActionListContext
Type
string
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
Required. The list context this action applies to. Valid values are:
  • Chatter
  • FeedElement
  • FlexiPage
  • Global
  • ListView
  • ListViewRecord
  • MruList
  • MruRow
  • ObjectHomeChart
  • Photo
  • Record
  • RecordEdit
  • RelatedList
  • RelatedListRecord
ActionTarget
Type
string
Properties
Nillable
Description
The URL to invoke or describe the action when the user invokes the action. If the action is a standard button overridden by a Visualforce page, the ActionTarget returns the URL of the Visualforce page like this: /apex/pagename.
This field is available in API version 35.0 and later.
ActionTargetType
Type
string
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
The type of the target when this action is triggered. Valid values are:
  • Describe—applies to actions with a user interface, such as quick actions
  • Invoke—applies to actions with no user interface, such as action links or dynamic actions
  • Visualforce—applies to standard buttons that have been overridden by a Visualforce page
ActionTargetUrl
Type
string
Properties
Filter, Group, Nillable, Sort
Description
URL to invoke or describe the action when the user invokes the action. This field is deprecated in API version 35.0 and later. Use ActionTarget instead.
Category
Type
string
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
Applies only to action links. Denotes whether the action link shows up in the feed item list of actions or the overflow list of actions. Valid values are:
  • Primary
  • Overflow
ConfirmationMessage
Type
string
Properties
Filter, Group, Nillable, Sort
Description
Applies only to action links. The message to display before the action is invoked. Field is null if no confirmation is required prior to invoking the action.
DeviceFormat
Type
string
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
Specifies which action icon is returned by the PlatformAction query. If this field isn’t specified, it defaults to Phone. Valid values are:
  • Aloha
  • Desktop
  • Phone
  • Tablet
ExternalId
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The unique ID for the PlatformAction. If the action doesn’t have an ID, its API name is used.
GroupId
Type
ID
Properties
Filter, Group, Nillable, Sort
Description
The unique ID of a group of action links.
IconContentType
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The content type—such as .jpg, .gif, or .png—of the icon for this action. Applies to both custom and standard icons assigned to actions.
IconHeight
Type
int
Properties
Filter, Group, Nillable, Sort
Description
The height of the icon for this action. Applies only to standard icons.
IconUrl
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The URL of the icon for this action.
IconWidth
Type
int
Properties
Filter, Group, Nillable, Sort
Description
The width of the icon for this action. Applies only to standard icons.
InvocationStatus
Type
string
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
The status of the action within the feed item. Applies to action links only. Valid values are:
  • Failed
  • New
  • Pending
  • Successful
InvokedByUserId
Type
ID
Properties
Filter, Group, Nillable, Sort
Description
The ID of the user who most recently invoked this action within the current feed item. Applies to action links only.
IsGroupDefault
Type
boolean
Properties
Filter, Group, Sort
Description
Denotes whether this action is the default in an action link group. False for other action types. Applies to action links only.
Label
Type
string
Properties
Filter, Group, Sort
Description
The label to display for this action.
PrimaryColor
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The primary color of the icon for this action.
RelatedSourceEntity
Type
string
Properties
Filter, Group, Nillable, Sort
Description
When the ActionListContext is RelatedList or RelatedListRecord, this field represents the API name of the related list to which the action belongs.
Section
Type
string
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
The section of the user interface the action resides in. Applicable only to Lightning Experience. Valid values are:
  • ActivityComposer
  • CollaborateComposer
  • NotesComposer
  • Page
  • SingleActionLinks
This field is available in API version 35.0 and later.
SourceEntity
Type
string
Properties
Filter, Group, Sort
Description
Required. The object or record with which this action is associated.
Subtype
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The subtype of the action. For quick actions, the subtype is QuickActionType. For custom buttons, the subtype is WebLinkTypeEnum. For action links, subtypes are Api, ApiAsync, Download, and Ui. Standard buttons and productivity actions have no subtype.
Type
Type
string
Properties
Filter, Group, Restricted picklist, Sort
Description
The type of the action. Valid values are:
  • ActionLink—An indicator on a feed element that targets an API, a web page, or a file and is represented by a button in the Salesforce Chatter feed UI.
  • CustomButton—When clicked, opens a URL or a Visualforce page in a window or executes JavaScript.
  • InvocableAction
  • ProductivityActionProductivity actions are predefined by Salesforce and are attached to a limited set of objects. You can’t edit or delete productivity actions..
  • QuickAction—A global or object-specific action.
  • StandardButton—A predefined Salesforce button such as New, Edit, and Delete.

Usage

PlatformAction can be described using describeSObject().

You can directly query for PlatformAction. For example, this query returns all fields for actions associated with each of the records of the listed objects:
1SELECT ExternalId, ActionTargetType, ActionTargetUrl, ApiName, Category,
2      ConfirmationMessage, ExternalId, GroupId, UiTheme, IconUrl, IconContentType, 
3      IconHeight, IconWidth, PrimaryColor, InvocationStatus, InvokedByUserId, 
4      IsGroupDefault, Label, LastModifiedDate, Subtype, SourceEntity, Type 
5FROM PlatformAction 
6WHERE SourceEntity IN ('001xx000003DGsH', '001xx000003DHBq', ‘Task’, ‘Global’) AND 
7      ActionListContext = ‘Record’;

To query PlatformAction, you must provide the ActionListContext and SourceEntity. If you query for ActionListContext with a value of RelatedList, and don't specify a RelatedSourceEntity, the query returns the API name of the related list.

Note

This query uses multiple ActionListContext values in its WHERE clause to return all actions in the Lightning Experience user interface (DeviceFormat = 'Desktop') for the specified object:
1SELECT ActionListContext, Label, Type, Subtype, Section, SourceEntity,
2     RelatedSourceEntity, ActionTarget, ActionTargetType, ApiName, Category, 
3     ConfirmationMessage, DeviceFormat, ExternalId, GroupId, IconContentType, 
4     IconHeight, IconUrl, IconWidth, Id, InvocationStatus, InvokedByUserId, 
5     IsGroupDefault, LastModifiedDate, PrimaryColor 
6FROM PlatformAction 
7WHERE ActionListContext IN ('Record','Chatter','RelatedList') AND 
8      SourceEntity = '001xx000003DlvX' AND 
9      DeviceFormat = 'Desktop'