Messaging Framework for Omniscripts

Communicate between an Omniscript, windows, Lightning web components, and Omniscript elements with window post messages, session storage messages, and PubSub messaging.

Determine which object or component needs to handle and use data, and use the corresponding property.

Property

Description

Object or Component

Example

Window postMessage

Send information from an element to a window object in key-value pairs.

Window object

Message with Window Post Messages and Session Storage Messages

Pub/Sub

Communicate with Omniscript from a custom LWC by sending key-value pairs. Use the events passed in the key-value pairs to trigger custom behavior in a component.

Lightning Web Components

Communicate from Omniscript to a Lightning Web Component

This topic is part of creating custom Lightning web components for Omniscripts.

Session Storage

Send information to a Session Storage object using key-value pairs. A session storage object clears when a page session ends.

Session Storage object

Message with Window Post Messages and Session Storage Messages

Message with Window Post Messages and Session Storage Messages

Communicate between Omniscript, windows, and components with window post messages and session storage messages.

Pass element information and data JSON from Omniscript elements containing the window post message, session storage message, and LWC Pub/Sub message. For information on using the pub/sub message in Omniscript, see Communicate from Omniscript to a Lightning Web Component.

  1. To add window post messages or session storage messages:
    1. In the element, check the Window Post Message checkbox or the Session Storage Message checkbox.

      Default Messaging:

      {
        Type: <element_type>,
        OmniEleName: <element_name>
      }
      When enabled, the default messaging sends the name of the element and the type of the element.
    1. (Optional) In the Messages property, add additional messaging to the node by entering a Key/Value pair.
      The Value field accepts merge syntax. For information on merge fields, see Access Omniscript Data JSON with Merge Fields.
    1. Pass a value in the c__messagingKey URL parameter to change the node that stores the messaging payload for window.postMessage and session storage message.
  2. To add messages to a Step:
    1. In the Step's properties, click Edit Properties as JSON.
    1. Paste in the following JSON before the closing curly bracket:
      "wpm": false,
      "ssm": false,
      "message": {}
    2. Enable WPM or SSM by setting the value equal to true.
      "wpm": true
    3. Add additional key/value pairs inside the message object.
      "message": {"Account":%AccountId%, "Status": %AccountStatus%}

What’s next: Preview the Omniscript and test the messaging behavior by inspecting the corresponding element in your browser’s console or developer tools.