You are here:
Extend an Omniscript Element’s Lightning Web Component
Add custom behavior and styling to an Omniscript element while maintaining its core functionality. Replace an Omniscript element's Lightning web component with a component that re-creates its properties and adds new ones.
Before you begin:
See Set Up Your Environment for Customizing Omniscript Elements.
A Lightning web component provides the HTML, JavaScript, XML, and CSS files for an Omniscript element. For example, a Text element has an extendable component named omniscriptText. For information about creating custom Lightning web components for Omniscripts that aren't element extensions, see Create a Custom Lightning Web Component for Omniscript.
Custom Lightning web components built outside of the managed package can’t use any Salesforce Lightning web component that uses Salesforce resources or affects the component at run time. See Salesforce Modules. If you turn off the Managed Package Runtime setting in Setup, we recommend that you don't extend Lightning web components such as Block or TypeAhead. Extending these components can introduce incompatibilities between Omnistudio and Omnistudio for Managed Packages.
-
In the
lwcfolder of your project, create a subfolder named lwcName.For example, create a subfolder named customText. -
In the new subfolder, create a file named
lwcName.js.For example, create a file named customText.js. - Paste this code into the JavaScript file. Substitute the name of your new component and the namespace of the Omniscript element's LWC.
-
In the subfolder, create a file named lwcName.js-meta.xml.
For example, create a file named customText.js-meta.xml.
- Paste this code into the XML file.
-
In the unzipped file structure, locate the folder of the Lightning web component
for the Omniscript element that you want to extend.
For example, locate the folder named omniscriptText.
-
Edit the HTML file.
- Right-click the HTML file and select Open With Visual Studio Code.
- Copy the content of the HTML file.
-
Create a file in the custom component subfolder named
lwcName.html.For example, create a file namedcustomText.html - Paste the copied content of the HTML file for the Lightning web component into the new HTML file.
-
To deploy the custom component to your Salesforce org, right-click the subfolder
and select Deploy Source to Org.
For more information, see Deploy Lightning Web Components.
-
Add the custom component to an Omniscript in one of these ways:
- Override an individual element by using LWC Component Override.
- Map all Omniscript elements of the type you're extending to the custom component.
- Override an Omniscript Element with a Custom Lightning Web Component
Override an Omniscript element with custom Lightning web components (LWCs) to add custom behavior and styling to the Omniscript element. - Override all Elements of an Omniscript Element Type with a Custom Lightning Web Component
To override all elements of a type in an Omniscript, map the element to the custom Lightning web component. You can't directly drag these components to the Omniscript canvas and map them to their custom Lightning web component. These components include Step Chart, Save for Later Acknowledge, and Modal.

