For the managed package runtime, beginning with Vlocity Insurance and Health Winter '20 and CME Winter '20 , apply responses from custom actions using the omniApplyCallResp() method.
This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.
The method accepts an object that it passes into the Omniscript's data JSON. If the root data node name in the response matches an element name in the Omniscript, that data prefills the element, and any nested elements, when it renders in the Omniscript. If the root node name does not match an element in the data JSON, the node inserts into the data JSON immediately. Applying the response works similar to the Send/Response property. For information, see Manipulate JSON with the Send/Response Transformations Properties (Managed Package).
input = JSON.parse(JSON.stringify(input));
this.omniApplyCallResp(input);
Method: omniApplyCallResp(response, usePubsub =
false)
Arguments:
-
response: The first argument,
response, is an object that merges into the data JSON. -
usePubSub: The second argument,
usePubSub,controls how the response passes up to the Omniscript header to merge into the data JSON. This boolean is set to false by default. When set to false,responseis sent to the Omniscript header via javascript events. When set to true,responseis sent to the Omniscript header by the pubsub module.The usePubSub argument enables users to call
omniApplyCallRespasynchronously. When running asynchronously, the UI is not blocked waiting for the response.Optionally perform a remote call by using the omniNextStep() method and calling the
omniApplyCallResp()method asynchronously.
This example demonstrates how the omniApplyCallResp() method updates Data JSON.
-
View the current data JSON before running omniApplyCallResp().
{ "Step1" : { "Currency1" : 12345, "Text1" : "data1" }, "Step2" : { "Text3": "data3" } } -
Call omniApplyCallResp and pass data as an argument.
let myData = { "Step1" : { "CustomLWC1" : "newprop" }, "Anotherprop" : { "prop1" : "anothervalue" } } this.omniApplyCallResp(myData); -
View the updated data JSON.
{ "Step1" : { "Currency1" : 12345, "Text1" : "data1", "CustomLWC1" : "newprop" }, "Step2" : { "Text3": "data3" }, "Anotherprop" : { "prop1" : "anothervalue" } }