Update of the Custom Lightning Web Component Element's Data (Managed Package)

For the managed package runtime, apply the response of a Custom LWC callout to the Custom LWC element by using the omniUpdateDataJson method.

Managed Package app icon This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.

Method: omniUpdateDataJson(input, aggregateOverride = false)

Arguments:

  • input: The first argument, input, accepts data in an object or primitive data type. Undefined is not accepted. The input data either replaces the current value or merges with the existing data depending on the setting of the second argument, aggregateOverride.
  • aggregateOverride: The second argument, aggregrateOverride, controls how the data saves to the data JSON. It is an optional argument that is set to false by default. When set to false, the input data merges with the existing data. If the data is not an object it does not merge into the data JSON. When set to true, the input data overrides any existing data in the Custom LWC element.
Example
Example
  • Pass the input argument with the default aggregrateOverride behavior:
    let myData = "myvalue" // any kind of data that is a string, object, number, etc
    
    
    this.omniUpdateDataJson(this.myData);
  • Pass the the input argument with the aggregateOverride argument set to false:
    // 1. first call to omniUpdateDataJson
    // input for omniUpdateDataJson when aggregateOverride = false
    {
      "prop1" : "data1" 
    }
    
    // 2. output of data JSON after the first call
    // 
    {
    "Step1" : {
       "CustomLWC1" : {
          "prop1": "data1"
       }
    }
    
    // 3. second call to omniUpdateDataJson
    // input for omniUpdateDataJson when aggregateOverride = false
    {
      "prop2" : "data2"
    }
    
    // 4. output of data JSON after the second call
    // notice that the value of CustomLWC1 contains both prop1 and prop2 
    // because the data is merged instead of replaced when aggregateOverride is set to false
    {
    "Step1" : {
       "CustomLWC1" : {
          "prop1": "data1",
          "prop2": "data2"
       }
    }