Vlocity/Omnistudio

Call Integration Procedure from LWC

An Integration Procedure in Vlocity/Omnistudio provides you with the capability to perform CRUD operations within Salesforce data.

You can call Integration Procedure from LWC (Lightning Web Component), which will be responsible for the user interface, allowing users to interact with the database. Here we'll show you examples in how to do it.

Call Integration Procedure from LWC

Prerequisites

Before to call Integration Procedure from LWC, there are a few prerequisites that you need to have to implement this functionality properly:

1. XML

In the XML file of the LWC, you need to include the Vlocity/Omnistudio namespace of your current org. You can check this namespace on: Setup > Installed Packages. Here is a screenshot for reference:

Vlocity/Omnistudio namespace name of the current org

Once you know your own Vlocity namespace, you need to update the XML by including that namespace in the runtimeNamespace node, also do not forget about the isExposed in true. Here is how the XML looks like:

file_type_xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>56.0</apiVersion>
    <isExposed>true</isExposed>
	<runtimeNamespace>vlocity_ins</runtimeNamespace>
</LightningComponentBundle>

2. Extend omniscriptBaseMixin

To adapt the LWC to vlocity, you need to import and extend the omniscriptBaseMixin on your component. In this step you also need to use your own namespace on the import:

import { LightningElement } from 'lwc';
import { OmniscriptBaseMixin } from "vlocity_ins/omniscriptBaseMixin";

export default class CallIPFromLWC extends OmniscriptBaseMixin(LightningElement){

}

Call the Integration Procedure

After you completed the prerequisites, you will be able to call the Omnistudio Integration Procedure on the LWC. Let's start from the begging, the parameters to make it work.

Here we will declare a new object to use in the omniRemoteCall where we will specify the input, Integration Procedure name, and the options.

const params = {
	input: JSON.stringify({accountName: 'John', age: 35, childrenAge: [7, 15, 22]}),
	sClassName: 'vlocity_ins.IntegrationProcedureService',
	sMethodName: 'CallIp_FromLWC',
	options: '{}',
}