Configure a Component for Dynamic Interactions in the Lightning App Builder

It takes both admins and developers to make Dynamic Interactions work, but the keystone is a custom source component that defines the properties of the event to be triggered. Add event metadata and properties to your source component to expose the event to the Lightning App Builder, where an admin can then configure the targets and interactions for the event.

Only Lightning web components can be source components, but any component (Aura or LWC) can be a target. To expose an event from a source component, you fire a standard JavaScript CustomEvent in its .js file. To make the event discoverable, use Dynamic Interactions-specific metadata in the component js-meta.xml file, similar to how properties for builders are exposed.

For an overview of Dynamic Interactions, see Salesforce Help.

Note

Use Dynamic Interactions to Expose an Event 

Dynamic Interactions uses two targetConfig subtags that you can put in your source component bundle’s componentName.js-meta.xml file to expose an event.

  • event
  • schema

These subtags are only available for a targetConfig with the target lightning__AppPage.

Note

Here’s a sample js-meta.xml configuration file for an Account List source component. It includes an itemselected event, and its schema includes apiName and recordId as defined in the .js file.

1<?xml version="1.0" encoding="UTF-8"?>
2<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
3  <apiVersion>52.0</apiVersion>
4  <isExposed>true</isExposed>
5  <masterLabel>Account List</masterLabel>
6  <targets>
7    <target>lightning__AppPage</target>
8  </targets>
9  <targetConfigs>
10    <targetConfig targets="lightning__AppPage">
11      <property name="apiName" type="String"/>
12      <property name="listViewApiName" type="String"/>
13      <event name="itemselected" label="Item Selected" description="This event fires when an item is selected.">
14        <schema>
15          {
16            "type": "object",
17            "properties": {
18              "recordId": {
19                "type": "string",
20                "title": "Record ID"
21                "description": "Enter an 18-digit record ID."
22          },
23              "apiName": {
24                "type": "string"
25              }
26            }
27          }
28        </schema>
29      </event>
30    </targetConfig>
31  </targetConfigs>
32  <description>meta xml description</description>
33</LightningComponentBundle>

Considerations for the .js-meta.xml File 

  • Dynamic Interactions uses only type and properties from the schema. All other items in the schema are ignored.
  • The only supported property attributes are type, title, and description.
  • In the event schema, the only valid property types supported are String, Integer, and Boolean.
  • The event tag metadata isn’t validated against the .js file.

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.