Loading
Salesforce now sends email only from verified domains. Read More
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Access Omniscript Data JSON with Merge Fields

          Access Omniscript Data JSON with Merge Fields

          Enable Omniscript elements and element properties to access data JSON using merge fields. A merge field is a variable that references the value of a JSON node. For example, if a JSON node is "FirstName": "John", then the merge field %FirstName% returns John.

          Merge fields access data JSON using syntax to indicate to an Omniscript Element that a merge field is present. The syntax requires you to wrap a full JSON path with a percent sign on both ends.

          Note
          Note

          Only certain element properties support merge fields.

          Text between two percent (%) signs in a Set Values formula or text field is treated as a merge field. To represent literal percent (%) signs, use the $Vlocity.Percent environment variable.

          Common Use Cases for Accessing JSON with Merge Fields

          Learn about common use cases for accessing Omniscript data JSON with merge fields.

          • Setting Values to rename elements, access JSON nodes, run formulas, and populate elements. For more information, see Set Values in an Omniscript
          • Access data stored in Omniscript elements in a formula or in a future step.
          • Access data returned from an Action. For example, an HTTP Action or Omnistudio Data Mapper Action returns data from Salesforce or an external source. For more information on Actions, see Omniscript Action Elements.
          • Access data passed in as a parameter from a page.

          Access the Data JSON

          Use existing data JSON in an element property by indicating the use of a merge field.

          1. Locate the name of the JSON node in the Omniscript's data JSON.
            Example of a JSON node named firstName with a value of John
          2. Enter the name of the JSON node and wrap the name in percentage signs to indicate it is a merge field.

            For example, a merge field accessing a JSON node named firstName must use the syntax %firstName%.

            Merge field that refers to the firstName JSON node
          3. Preview the Omniscript to ensure the Merge field works correctly.
            Preview of the Omniscript that shows "Welcome, John!"

          Additional Syntax

          Check out additional syntax examples for nested JSON.

          JSON Node Merge Field Syntax Example
          "ContactInfo": {
              "FirstName": "John"
            }

          Use a colon symbol : to access a nested JSON node.

          %ContactInfo:FirstName%
          "ParentObject": {
              "NumberMap": [
                1,
                2,
                3
              ]
            }

          Use a colon symbol : to access nested JSON nodes and a pipe symbol | to access the index of the array that value.

          %ParentObject:NumberMap|3%
           "ContactInfoStep": {
              "ContactInfoBlock": [
                {
                  "FirstName": "John"
                },
                {
                  "FirstName": "Adam"
                },
                {
                  "FirstName": "Steve"
                }
              ]
            }

          When a formula exists within a repeatable block, use |n to access the node in which the formula exists. Depending upon which node the formula exists in, it will return the correlating value. For more information, see Access to Data Within and Outside a Repeatable Block.

          %ContactInfoStep:ContactInfoBlock|n:FirstName%
           
          Loading
          Salesforce Help | Article