Detect Data JSON Updates in an Embedded Omniscript (Managed Package)

For the managed package runtime, detect changes in an embedded Omniscript's data JSON using the omniaggregate event.

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

  1. In your Lightning Web Component's JavaScript file, add an event listener that accepts the omniaggregate event as an argument.
    this.template.addEventListener( 'omniaggregate');
  2. Create a separate function that handles the response of the event and assigns the value to a variable.
    omniUpdateHandler(event) {
    	if(event.detail) {
            this.omniDataJSON = event.detail;
            // do something with the data JSON
        }
  3. Add the function that handles the response as an argument to the event listener so that it fires whenever the Omniscript data JSON updates.
    this.template.addEventListener( 'omniaggregate', (event) => { this.omniUpdateHandler(event) });