Mapping of Responses to the Omniscript's Data JSON (Managed Package)

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.

Managed Package app icon 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).

Note
Note The method can't support proxy objects. To include proxy inputs, you must first clone the input object by using JSON.parse and JSON.stringify and then pass it to the method, as shown in this example.
Example
Example
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, response is sent to the Omniscript header via javascript events. When set to true, response is sent to the Omniscript header by the pubsub module.

    The usePubSub argument enables users to call omniApplyCallResp asynchronously. 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.

Example
Example

This example demonstrates how the omniApplyCallResp() method updates Data JSON.

  1. View the current data JSON before running omniApplyCallResp().

    {
                         "Step1" : {
                         "Currency1" : 12345,
                         "Text1" : "data1"
                         },
                         "Step2" : {
                         "Text3": "data3"
                         }
                         }
  2. Call omniApplyCallResp and pass data as an argument.

    let myData = {
                         "Step1" : {
                         "CustomLWC1" : "newprop"
                         },
                         "Anotherprop" : {
                         "prop1" : "anothervalue"
                         }
                         }
                         
                         this.omniApplyCallResp(myData);
  3. View the updated data JSON.

    {
                         "Step1" : {
                         "Currency1" : 12345,
                         "Text1" : "data1",
                         "CustomLWC1" : "newprop"
                         },
                         "Step2" : {
                         "Text3": "data3"
                         },
                         "Anotherprop" : {
                         "prop1" : "anothervalue"
                         }
                         }