Invoking Integration Procedures from a Lightning Web Component (LWC)
This article will help you to fetch the Data using the Integration Procedure from Salesforce and populate it through the Lightning Web component (LWC). Also, to Insert/update the Data in Salesforce through the Integration Procedure from LWC.
Why and when?
Basically, the Integration procedure is used to communicate with external data sources or services, and API from within Lightning Web Components. Here are some of the additional benefits when we are invoking the integration procedure from LWC.
How to Implement?
Note: Before Implementing your logic, make sure you have a Vlocity Salesforce org. The following link helps you to sign up/log in with Vlocity developer trail org - Vlocity Development Org
Once you have Vlocity developer Org credentials, you are in good shape to build your logic.
IP in LWC
Example 1 will help you to understand how to access the records from the Integration procedure by achieving through the Lightning Web Component. Here we are passing automated record Id and sObject as the input of the IP that is sending via LWC and getting output response as JSON format from the IP.
Based on the expected Output from the IP(Integration Procedure), LWC can do the logic to further proceed.
Example 1:
Recommended by LinkedIn
b. Go Back to your newly created LWC Component and open the meta.xml file. Apply the namespace within the tag like <runtimeNamespace>vlocity_cmt</runtimeNamespace>
c. Update the isExposed tag to True.
d. Now open the Js file. Import OmniscriptActionCommonUtil. Create the instance for omniUtil wherever you want. In this example, The instance is created in connectedCallback() through the getBookStore() method.
e. The excuteAction() method helps to connect the IP and return the Response.
f. From the above example the IP passes the input parameters subject and Record ID and returns the JSON type response (fetching custom metadata Values with a combination of recorded required values).
g. In LWC, we are passing the Same input parameter using the params attribute as mentioned in the above screenshot.
h. Once you get the response result in your JS code(LWC), you can proceed with your logic with that.
Output From IP (Integration Procedure):
Expected Output From LWC: