Give embedded widgets real-time access to record context and org data, and receive user-interaction events back, without custom integration code or managing authentication tokens.
Where: This change applies to Lightning Experience, Experience Builder sites, and Experience Cloud LWR sites in all editions.
Note The Dev Channel provides access to features that are not generally available and have been designated as pilot, beta, limited release, or developer preview. Their use is at the Customer's sole discretion and is subject to the Beta Services Terms at Agreements - Salesforce.com.
How: Push data from the host to the widget:
- In your wrapper LWC, call
shell.updateData({ recordId, locale }). Payloads sent before the iframe handshake completes are queued and delivered automatically. Payloads are sent viapostMessagewhich internally usesstructuredClone, so objects like DOM Elements and Functions aren't allowed. - Payloads must be JSON-serializable. Non-JSON types like
Date,Map,Set, andBlobaren't supported. For example,Dateobjects are converted to ISO strings. Functions, DOM nodes, and class instances are dropped. For complex values, useJSON.stringify()before passing and parse them on the widget side.
Receive events from the widget:
- Listen on the shell element:
shell.addEventListener('event-name', handler). The MFE Bridge re-fires widget events asCustomEvents on the host element. - Event names on the shell are kebab-case (for example,
dealer-selected). Because LWC templates reject hyphens inon…handler names, subscribe viaaddEventListener— not template event bindings.