PlatformAction

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

Supported Calls 

describeSObjects(), query()

Fields 

FieldTypePropertiesDescription
ActionListContextpicklistFilter, Group, Nillable, Restricted picklist, SortRequired. The list context this action applies to. See Valid values for ActionListContext.
ActionTargettextareaNillableThe URL to invoke or describe the action when the action is invoked. If the action is a standard button overridden by a Visualforce page, the ActionTarget returns the URL of the Visualforce page, such as /apex/pagename. This field is available in API version 35.0 and later.
ActionTargetTypepicklistFilter, Group, Nillable, Restricted picklist, SortThe type of the target when this action is triggered. Valid values: Describe (actions with a user interface, such as quick actions), Invoke (actions with no user interface, such as action links or invocable actions), or Visualforce (standard buttons overridden by a Visualforce page).
ActionTargetUrlstringFilter, Group, Nillable, SortURL to invoke or describe the action when the action is invoked. This field is deprecated in API version 35.0 and later. Use ActionTarget instead.
CategorypicklistFilter, Group, Nillable, Restricted picklist, SortApplies 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: Primary or Overflow.
ConfirmationMessagestringFilter, Group, Nillable, SortApplies only to action links. The message to display before the action is invoked. Field is null if no confirmation is required before invoking the action.
DeviceFormatpicklistDefaulted on create, Filter, Group, Nillable, Restricted picklist, SortSpecifies which action icon the PlatformAction query returns. If this field isn’t specified, it defaults to Phone. Valid values: Aloha, Desktop, Phone, or Tablet.
ExternalIdstringFilter, Group, Nillable, SortThe unique ID for the PlatformAction. If the action doesn’t have an ID, its API name is used.
GroupIdreferenceFilter, Group, Nillable, SortThe unique ID of a group of action links.
IconContentTypestringFilter, Group, Nillable, SortThe content type—such as .jpg, .gif, or .png—of the icon for this action. Applies to both custom and standard icons assigned to actions.
IconHeightintFilter, Group, Nillable, SortThe height of the icon for this action. Applies only to standard icons.
IconUrlurlFilter, Group, Nillable, SortThe URL of the icon for this action.
IconWidthintFilter, Group, Nillable, SortThe width of the icon for this action. Applies only to standard icons.
InvocationStatuspicklistFilter, Group, Nillable, Restricted picklist, SortThe status of the action within the feed item. Applies to action links only. Valid values: Failed, New, Pending, or Successful.
InvokedByUserIdreferenceFilter, Group, Nillable, SortThe ID of the user who most recently invoked this action within the current feed item. Applies to action links only. This is a relationship field. Relationship Name: InvokedByUser. Relationship Type: Lookup. Refers To: User.
IsGroupDefaultbooleanDefaulted on create, Filter, Group, SortDenotes whether this action is the default in an action link group. False for other action types. Applies to action links only.
IsMassActionbooleanDefaulted on create, Filter, Group, SortIndicates whether the action can be performed on multiple records. This field is available in API version 38.0 and later.
LabelstringFilter, Group, SortThe label to display for this action.
PrimaryColorstringFilter, Group, Nillable, SortThe primary color of the icon for this action.
RelatedListRecordIdstringFilter, Group, Nillable, SortRepresents the ID of a record in an object’s related list. This field is available in API version 38.0 and later.
RelatedSourceEntitystringFilter, Group, Nillable, SortWhen the ActionListContext is RelatedList or RelatedListRecord, this field represents the API name of the related list to which the action belongs.
SectionpicklistFilter, Group, Nillable, Restricted picklist, SortThe section of the user interface the action resides in. Applicable only to Lightning Experience. Valid values: ActivityComposer, CollaborateComposer, NotesComposer, Page, or SingleActionLinks. This field is available in API version 35.0 and later.
SourceEntitystringFilter, Group, SortRequired. The object or record with which this action is associated.
SubtypestringFilter, Group, Nillable, SortThe 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.
TargetObjectstringFilter, Group, Nillable, SortThe type of object record the action creates, such as a contact or opportunity. This field is available in API version 41.0 and later.
TargetUrlstringFilter, Nillable, SortThe URL that a custom button or link points to. This field is available in API version 41.0 and later.
TypepicklistFilter, Group, Restricted picklist, SortThe type of the action. Valid values: ActionLink (an indicator on a feed element that targets an API, a web page, or a file, 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, ProductivityAction (predefined and attached to a limited set of objects; includes Send Email, Call, Map, View Website, and Read News; except for the Call action, you can’t edit them), QuickAction (a global or object-specific action), or StandardButton (a predefined Salesforce button such as New, Edit, and Delete).

Valid values for ActionListContext:

  • Assistant
  • BannerPhoto
  • Chatter
  • Dockable
  • FeedElement
  • Flexipage
  • Global
  • ListView
  • ListViewDefinition
  • ListViewRecord
  • Lookup
  • MruList
  • MruRow
  • ObjectHomeChart
  • Photo
  • Record
  • RecordEdit
  • RelatedList
  • RelatedListRecord

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') AND 
7      ActionListContext = 'Record';

To query PlatformAction, 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. In API v43.0 and before, SourceEntity = 'Object API Name' and ActionListContext = 'ListView' is an invalid combination to fetch quick actions in a SOQL query. Use SourceEntity = 'Object ID' and ActionListContext = 'ListView' instead.

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'