lightning__RecordAction Target

Enables a component to be used as a quick action on a record page. To specify the type of quick action, define a targetConfig with an actionType attribute.

Syntax 

1<?xml version="1.0" encoding="UTF-8" ?>
2<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
3  <apiVersion>58.0</apiVersion>
4  <isExposed>true</isExposed>
5  <targets>
6    <target>lightning__RecordAction</target>
7  </targets>
8  <targetConfigs>
9    <targetConfig targets="lightning__RecordAction">
10      <actionType>ScreenAction</actionType>
11    </targetConfig>
12  </targetConfigs>
13</LightningComponentBundle>

targetConfigs 

Configures the component for a record action and defines component properties. The targetConfigs tag contains at least one targetConfig tag.

targetConfig 

Configures a page type with this attribute.

AttributeDescriptionRequired
targetsSpecify one or more page types in the targets attribute, such as <targetConfig targets="lightning__RecordAction"> or <targetConfig targets="lightning__RecordAction,lightning__RecordPage">. The targets attribute value must match one or more of the page types that you listed under <targets>.Yes
actionTypeSpecify the type of Lightning web component quick action. Valid values are:
  • ScreenAction—(Default) Runs custom code in a modal window
  • Action—Runs custom code without opening a modal window
See Configure a Component for Quick Actions.

lightning__RecordAction doesn’t support component properties.

supportedFormFactors 

A set of one or more form factors or devices that the component supports. Specify the supportedFormFactors tag set one time inside a targetConfig set. The supportedFormFactors tag contains at least one supportedFormFactors tag.

supportedFormFactor 

Defines which form factor or device the component supports. Use one supportedFormFactor tag for each supported form factor.

The supportedFormFactor tag supports this attribute.

AttributeTypeDescriptionRequired
typeStringDevice form factor on which the component displays. Valid values are:
  • Large—Represents the desktop form factor.
  • Small—Represents the phone form factor. This value isn’t supported for lightning__RecordAction because LWC quick actions don’t appear in the Salesforce mobile app.
Yes

We strongly recommend including supported form factor information in the configuration file. See Configure Your Component for Different Form Factors.

Note

Usage 

You can use a quick action to navigate to an object page, such as the Contact home page. In this example, a headless quick action executes custom code you provide in an @api invoke() method.

navigateToRecordHeadlessAction.js
1import { LightningElement, api } from 'lwc';
2import { NavigationMixin } from 'lightning/navigation';
3
4export default class NavigateToRecordHeadlessAction extends NavigationMixin(
5    LightningElement
6) {
7    @api invoke() {
8        this[NavigationMixin.Navigate]({
9            type: 'standard__objectPage',
10            attributes: {
11                objectApiName: 'Contact',
12                actionName: 'home'
13            }
14        });
15    }
16}

A headless quick action corresponds to the Action type.

navigateToRecordHeadlessAction.js-meta.xml
1<?xml version="1.0" encoding="UTF-8" ?>
2<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
3  <apiVersion>66.0</apiVersion>
4  <isExposed>true</isExposed>
5  <targets>
6    <target>lightning__RecordAction</target>
7  </targets>
8
9  <targetConfigs>
10    <targetConfig targets="lightning__RecordAction">
11      <actionType>Action</actionType>
12    </targetConfig>
13  </targetConfigs>
14</LightningComponentBundle>

You can’t change the action type after you’ve defined it in the configuration file. For example, you can’t change a component’s action type from Action to ScreenAction or vice versa after you deploy your component.

Note

Creating an LWC action in Lightning Experience is similar to creating a regular quick action. For more information, see Salesforce Help: Lightning Web Component Actions. If you’re creating a LWC action for the Field Service mobile app, see Salesforce Help: Create Quick Actions for the Field Service Mobile App.

To enable a component to be used as a global quick action, use lightning__GlobalAction instead.

See Also

Release Preview

This release is in preview. Features described here don't become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can't guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.