You are here:
Create a Standalone Custom Lightning Web Component
Enable custom Lightning web components to act independently from an Omniscript by adding it to the Omniscript as a standalone component. Standalone custom Lightning web components cannot extend any Omniscript element component or the OmniscriptBaseMixin component. The standalone component supports custom functionalities, but cannot interact with an Omniscript or the Omniscript's data JSON.
- Review and complete the requirements for creating a standalone custom Lightning Web component. See Requirements for Custom Lightning Web Components for Omniscripts.
-
Construct additional data JSON nodes in the Custom LWC element and pass values down from the element into the new JSON nodes using the
omniaggregateevent. See Create and Map Data Inside the Custom LWC Element. - Add the standalone custom Lightning web component to an Omniscript. See Custom LWC Element.
See Also
Create and Map Data Inside the Custom LWC Element
Construct additional data JSON nodes in the Custom LWC
element and pass values down from the element into the new JSON nodes using the omniaggregate event.
For more information on events, see Create and Dispatch Events.
Event: omniaggregate
-
Create a custom aggregate function and set the
omniaggregateevent to a variable.Example:customAggregate() { const eventName = 'omniaggregate' } -
Create a variable to store the LWC element's input data.
Example:
customAggregate() { const eventName = 'omniaggregate' const data = { anyKeyName : 'myElementData' }; } -
Construct an object by mapping the data to the key
data, and an element name to the key
elementId.
customAggregate() { const eventName = 'omniaggregate' const data = { anyKeyName : 'myElementData' }; const detail = { data: data, elementId: 'elementName2' }; } -
(Optional) In the detail object, include the key-value pair
aggregateOverride: trueto override all existing data in the Custom LWC element.customAggregate() { const eventName = 'omniaggregate' const data = { anyKeyName : 'myElementData' }; const detail = { data: data, elementId: 'elementName2', aggregateOverride: true }; } -
Create a new event object that passes the omniaggregate event and an object
containing these four properties:
- bubbles: A boolean that determines if the event bubbles up to the DOM.
- cancelable: A boolean that determines if the event is cancelable.
- composed: A boolean that determines if the event can pass through the shadow boundary.
- detail: Data passed in the event.
Example:omniAggregate() { const eventName = 'omniaggregate' const data = { anyKeyName : 'myElementData' }; const detail = { data: data, elementId: 'elementName2' }; const myEvent = new CustomEvent(eventName, { bubbles: true, cancelable: true, composed: true, detail: detail, }); } -
Call
this.dispatchEvent()and pass in the event object as a parameter.Code Example
Data JSON Result Example
// code to call omniAggregate() { const eventName = 'omniaggregate' const data = { anyKeyName : 'myElementData' }; const detail = { data: data, elementId: 'elementName2' }; const myEvent = new CustomEvent(eventName, { bubbles: true, cancelable: true, composed: true, detail: detail, }); this.dispatchEvent(myEvent); }"CustomLWC12": { "elementName1": { "prop": "prop1" }, "elementName2": { "anyKeyName": "myElementData" } }

