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

Field Type Properties Description
ActionListContext picklist Filter, Group, Nillable, Restricted picklist, Sort Required. The list context this action applies to. See Valid values for ActionListContext.
ActionTarget textarea Nillable The 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.
ActionTargetType picklist Filter, Group, Nillable, Restricted picklist, Sort The 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).
ActionTargetUrl string Filter, Group, Nillable, Sort URL 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.
Category picklist Filter, Group, Nillable, Restricted picklist, Sort 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: Primary or Overflow.
ConfirmationMessage string Filter, Group, Nillable, Sort Applies 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.
DeviceFormat picklist Defaulted on create, Filter, Group, Nillable, Restricted picklist, Sort Specifies which action icon the PlatformAction query returns. If this field isn't specified, it defaults to Phone. Valid values: Aloha, Desktop, Phone, or Tablet.
ExternalId string Filter, Group, Nillable, Sort The unique ID for the PlatformAction. If the action doesn't have an ID, its API name is used.
GroupId reference Filter, Group, Nillable, Sort The unique ID of a group of action links.
IconContentType string Filter, Group, Nillable, Sort 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 int Filter, Group, Nillable, Sort The height of the icon for this action. Applies only to standard icons.
IconUrl url Filter, Group, Nillable, Sort The URL of the icon for this action.
IconWidth int Filter, Group, Nillable, Sort The width of the icon for this action. Applies only to standard icons.
InvocationStatus picklist Filter, Group, Nillable, Restricted picklist, Sort The status of the action within the feed item. Applies to action links only. Valid values: Failed, New, Pending, or Successful.
InvokedByUserId reference Filter, Group, Nillable, Sort The 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.
IsGroupDefault boolean Defaulted on create, Filter, Group, Sort Denotes whether this action is the default in an action link group. False for other action types. Applies to action links only.
IsMassAction boolean Defaulted on create, Filter, Group, Sort Indicates whether the action can be performed on multiple records. This field is available in API version 38.0 and later.
Label string Filter, Group, Sort The label to display for this action.
PrimaryColor string Filter, Group, Nillable, Sort The primary color of the icon for this action.
RelatedListRecordId string Filter, Group, Nillable, Sort Represents the ID of a record in an object's related list. This field is available in API version 38.0 and later.
RelatedSourceEntity string Filter, Group, Nillable, Sort When the ActionListContext is RelatedList or RelatedListRecord, this field represents the API name of the related list to which the action belongs.
Section picklist Filter, Group, Nillable, Restricted picklist, Sort The 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.
SourceEntity string Filter, Group, Sort Required. The object or record with which this action is associated.
Subtype string Filter, Group, Nillable, Sort 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.
TargetObject string Filter, Group, Nillable, Sort The type of object record the action creates, such as a contact or opportunity. This field is available in API version 41.0 and later.
TargetUrl string Filter, Nillable, Sort The URL that a custom button or link points to. This field is available in API version 41.0 and later.
Type picklist Filter, Group, Restricted picklist, Sort The 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'