You are here:
Extend an Omniscript Element's Lightning Web Component (Managed Package)
For the managed package runtime, 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.
This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.
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.
Custom Lightning web components built outside of the package can't use any Salesforce Lightning web component that uses Salesforce resources or affects the component at runtime. For more information, see Salesforce Modules.
To extend an Omniscript element's Lightning web component:
- Set up Visual Studio Code on your computer and install the Salesforce Extension Pack. See Set Up Lightning Web Components (Managed Package).
- In Visual Studio Code, type Command-Shift-P (Mac) or Ctrl-shift-P (Windows) to open the command palette, and use the SFDX: Authorize an Org command to log into your org.
- In Visual Studio Code, use the SFDX: Create Project command to create a project, which includes an lwc folder.
-
Create a subfolder of lwc 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 (JS) file, substituting the indicated values.
import OmniscriptText from 'namespace/omniscriptText'; import tmpl from './customText.html'; export default class customText extends OmniscriptText { render() { return tmpl; } }-
Use the namespace of your org for namespace. For Omnistudio for Managed Packages, the namespace is either
vlocity_cmtorvlocity_ins. -
Use the name of the Omniscript element's LWC for OmniscriptText and omniscriptText.
-
Use the name of your new component for customText.
-
-
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, substituting the namespace of your org for
namespace.<?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="omniscript"> <apiVersion>60.0</apiVersion> <isExposed>true</isExposed> <runtimeNamespace>namespace</runtimeNamespace> <masterLabel>Custom LWC test</masterLabel> </LightningComponentBundle> - Download the LWC ZIP file from the appropriate link in the table of Lightning web components.
-
Unzip the downloaded file and locate its folder that contains the Lightning web
component for the Omniscript element you want to extend.
For example, locate the folder named omniscriptText.
- Copy the HTML file from the Omniscript element's folder to the subfolder in your Visual Studio Code project.
-
Rename the file lwcName.html.
For example, rename the file customText.html.
-
To edit the HTML file:
- Open the file in your browser.
- Right-click the blank content area.
- Select View Page Source.
- Copy all content from the file.
- Paste the content into a text editor.
-
In the HTML file, change every instance of
c-tonamespace-, substituting the namespace of your org for namespace. - To extend and customize the Omniscript element's functionality, edit the HTML file.
-
To change the element's styling, add an lwcName.css
file.
For example, add a CSS file named customText.css.
-
To deploy the custom component to your Salesforce org, right-click the subfolder
and select Deploy Source to Org.
For more information about deploying Lightning web components, see Deploy Lightning Web Components (Managed Package).
-
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.
For more information about adding custom Lightning web components to an Omniscript, see Add Custom Lightning Web Components to an Omniscript (Managed Package).

