Calling an Integration Procedure from a Lightning Web Component (LWC) in OmniScript
- VlocityGru
- 6 days ago
- 2 min read
In Vlocity/OmniStudio development, there are scenarios where your custom Lightning Web Component (LWC) needs to communicate with Integration Procedures (IPs). Luckily, Vlocity provides the omniRemoteCall() method, part of the OmniScriptBaseMixin, to enable this.
In this guide, we’ll walk through how to properly call an Integration Procedure from your LWC in an OmniScript context.
Prerequisites
You should have an OmniScript where the LWC will be embedded.
The Integration Procedure you want to call must already exist.
Your LWC should be set up to use the OmniScriptBaseMixin.
Step-by-Step Implementation
1. Import and Extend OmniScriptBaseMixin
In your LWC’s JavaScript file, import and extend from OmniScriptBaseMixin.
import { OmniscriptBaseMixin } from 'vlocity_ins/omniscriptBaseMixin';
import { LightningElement } from 'lwc';
export default class MyCustomLWC extends OmniscriptBaseMixin(LightningElement) {
...
}
Replace vlocity_ins with your namespace if LWS is disabled or you're using a managed package.
2. Set Metadata in XML
In your .js-meta.xml file, ensure the following:
<isExposed>true</isExposed>
<runtimeNamespace>vlocity_cmt</runtimeNamespace> <!-- Replace with your package namespace -->
3. Prepare Parameters for omniRemoteCall
Here’s a sample params object with key properties:
const options = {
chainable: true, // Useful for complex IPs to stay within governor limits
useFuture: true
};
const params = {
input: JSON.stringify(this.omniJsonData),
sClassName: `${this._ns}IntegrationProcedureService`, // E.g., 'vlocity_ins.IntegrationProcedureService'
sMethodName: 'Test_RemoteAction', // IP name in 'type_subtype' format
options: JSON.stringify(options),
};
4. Call the Integration Procedure
Use the omniRemoteCall() method to send your request.
this.omniRemoteCall(params, true)
.then(response => {
console.log('IP Response:', response?.result);
})
.catch(error => {
console.error('IP Error:', error);
});
"True" as the second parameter triggers the OmniScript spinner UI.
Output Structure
result: Contains the raw response from the server (your IP output).
error: Captures any error returned from Vlocity’s GenericInvoke2.
Final Tips
Always wrap your IP calls in try-catch or .then/.catch blocks to handle errors gracefully.
Use chainable: true in options if your IPs are complex or prone to CPU limits.
Test your LWC both inside and outside OmniScript context if reusability is expected.
Comments