Call IP from LWC Template
import { LightningElement, api, track } from "lwc";
import util from "vlocity_ins/utility"; // Import the utility library (adjust the import path as needed)
export default class MyCustomComponent extends LightningElement {
@track IPresponse = []; // This variable will store the DR response, can be an array [] or object {};
@track request = {
type: "IntegrationProcedures",
value: {
ipMethod: "IPType_IPSubType", // Specify the Integration Procedure method
inputMap: "{}", // Initialize the inputMap as an empty JSON object
optionsMap: "{}" // Initialize the optionsMap as an empty JSON object
}
};
handleBtnClick() {
// Populate the inputMap with key-value pairs as needed
this.request.value.inputMap = JSON.stringify({
// Add your input key-value pairs here
});
// Populate the optionsMap if required (e.g., for chainable)
this.request.value.optionsMap = JSON.stringify({
chainable: true // Set to true if required
});
// Call the Integration Procedure (IP) using the utility function
util.getDataHandler(JSON.stringify(this.request))
.then((result) => {
// Parse the DR response and store it in the IPresponse variable
this.IPresponse = JSON.parse(result);
})
.catch((reason) => {
// Handle any errors that occur during the IP call
});
}
}
Last updated