Loading
Feature degradation | Gmail Email delivery failureRead 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
          Set Values in an Omniscript

          Set Values in an Omniscript

          Use the Set Values action to set element values in subsequent steps, rename JSON nodes, create dynamic values, and concatenate data. Set Values actions use merge fields to access JSON data in other Omniscript elements.

          Action elements either render as a button when in a step or run remotely when between steps. Set Values actions are usually between steps.

          Use the Set Values action to:

          • Access and rename JSON data in other Omniscript elements by using merge fields
          • Populate subsequent elements with values
          • Concatenate values
          • Set values sent into the JSON data from a response or parameter
          • Use Omniscript functions and formula operators to set values

          Don’t use the Set Values action to:

          • Transform data
          • Relabel incoming JSON data

          Instead, use Integration Procedures and Omnistudio Data Mappers.

          Note
          Note

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

          The Set Values action doesn’t support custom labels.

          • Rename Data JSON Nodes
            Simplify and rename JSON node names by accessing the values in an Omniscript's data JSON. Access data sent into the Omniscript's data JSON from a parameter, an action's response data, or an element using merge fields.
          • Populate Input Elements with Set Values Action
            Populate subsequent input elements with values from data JSON, formula operators, functions, concatenations, and static values. Prefill an element directly from an Omnistudio Data Mapper or action response whenever possible. When a previous element assigns a value to a subsequent input element's Name, the subsequent input element is populated with the assigned value.
          • Concatenate Values with Set Values
            Create dynamic values by concatenating JSON node values.
          • Formulas and Functions with Set Values
            Generate dynamic values by evaluating data with formulas and functions to return specific values.
          • Set and Access Nested Data
            Set and access nested data by editing the Set Values JSON directly and using specific syntax.

          Rename Data JSON Nodes

          Simplify and rename JSON node names by accessing the values in an Omniscript's data JSON. Access data sent into the Omniscript's data JSON from a parameter, an action's response data, or an element using merge fields.

          1. From Omniscript Designer, click Preview.
          2. Preview the Omniscript and view the resulting data JSON.
          3. Locate the JSON node in the data JSON that you wish to rename.
          4. Add a Set Values Action to the Omniscript.
          5. In the Set Values Action, click Add Element Value.
          6. In the Element Value Map, in the Element Name field, enter the new JSON node name.
          7. In the Element Value Map, in the Value field, enter the name of the JSON node you wish to rename using merge field syntax to map it to the new JSON node.

            Here's an example of a Set Values action's Element Value Map that renames responses and parameters:

            Element Name Value
            FirstName %FirstNameHTTPResponse%
            LastName %LastNameHTTPResponse%
            Age %AgeParameter%
          8. Preview the Omniscript again and view the new JSON node name.

          Populate Input Elements with Set Values Action

          Populate subsequent input elements with values from data JSON, formula operators, functions, concatenations, and static values. Prefill an element directly from an Omnistudio Data Mapper or action response whenever possible. When a previous element assigns a value to a subsequent input element's Name, the subsequent input element is populated with the assigned value.

          For example, suppose a Set Values action has an Element Value Map that assigns an Element Name of FirstName with a Value of John. A subsequent Text element with a Name of FirstName populates with the value John.

          Note
          Note

          When populating an element using Set Values, data types must match. For example, you cannot set a Text element with a value from a Number element.

          1. In the Set Values Properties, click Add Element Value.
          2. In the Element Value Map, in the Element Name field, enter the name of an input element in a subsequent Step element.
            Note
            Note

            When the Element Name maps to an existing element in the Omniscript, the element's Type appears between the Element Name and the Value fields.

            For example, the subsequent Step element has Text elements FirstName and LastName, a Number element named Age, and a Date element named Date.
          3. In the Element Value Map, in the Value field, enter a literal value, a formula, or the name of another JSON node using merge syntax.
            Examples:
            Element Name Value
            FirstName "John"
            LastName %LastNameHTTPResponse%
            Age %AgeParameter%
            Date =TODAY()
          4. Preview the Omniscript to ensure the fields populate correctly.

          Concatenate Values with Set Values

          Create dynamic values by concatenating JSON node values.

          After you add an element value in a set values action, you must map a JSON node or element name to a value. Concatanate the nodes, elements, or literal values with the + operator, and use " " to add spaces where needed.

          ELment name Value
          Enter a JSON node or element name. Click fx and enter multiple merge fields or a combination of merge fields and literal values.

          Example of two merged fields: =%FirstName% + " " + %LastName%

          Example of a merged field and literal value: =%FirstName% + " " + "Smith"

          Formulas and Functions with Set Values

          Generate dynamic values by evaluating data with formulas and functions to return specific values.

          After you add an element value in a set values action, define the value for a JSON node or element name with a formula or function using Use Expression For Value. Add static values, or dynamic values using merge fields, and add an operator.

          Note
          Note

          Operators must have a space on each side for the operation to run correctly.

          To assign a null value in JSON or to check for null values in a data field, use $Vlocity.NULL. Use $Vlocity.NULL in these scenarios:

          Unset a field value
          To remove a value in a field by setting it to null. Use $Vlocity.NULL to make sure that the value is explicitly recognized as null by the system.
          Conditionally check for null
          Use $Vlocity.NULL in formulas to detect when a field is null. You can then trigger certain actions accordingly. Example: IF(%Step1:Multi-select1% == null, "$Vlocity.NULL", %Step1:Multi-select1%)
          Examples of Formulas and Functions in Set Values

          Example type

          Example Value Formula Syntax

          Merge values

          = %GrossIncome% - %NetIncome%

          Merge And literal values

          = %GrossIncome% - 5000

          Literal values

          = 2 - 2

          Set and Access Nested Data

          Set and access nested data by editing the Set Values JSON directly and using specific syntax.

          After you add an element value in a set values action, use Edit Properties as JSON to map a valid JSON structure to the node name created in Element Name.

          For example, ParentArray in the Element Name is mapped to a NumberMap array with three values:

          "elementValueMap": {
                    "ParentArray": {
                    "NumberMap": [
                    1000,
                    2000,
                    3000
                    ]
                    }
                    },
                  

          You can also access nested data, and set it to an element name or JSON node.

          In this case, the element for the set values action is a new JSON node name or element name.

          For the element's value, apply merge field syntax to access the appropriate value. For more information, see Access Omniscript Data JSON with Merge Fields.

           
          Loading
          Salesforce Help | Article