---
schema_version: "1"
id: 284641ae81f3383938d8473200bb8c115ad8cd2d41c1bc2cd338ce9d88a3e31c
title: Set Values in an Omniscript
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_set_values_in_an_omniscript_22132.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_set_values_in_an_omniscript_22132.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 5946537fb0e875241608f1a8a486a10a1bbfab030044d77cd1c0c19a069ebda9
description: 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.
products:
  - Omnistudio
release: "264"
---
# 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](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_note.png)

Note

Any text between two percent (%) signs in a Set Values formula is treated as a [merge field](https://help.salesforce.com/s/articleView?id=xcloud.os_access_omniscript_data_json_with_merge_fields_22053.htm&release=264.0.0&type=5 "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."). To represent literal percent (%) signs, use the `$Vlocity.Percent` [environment variable](https://help.salesforce.com/s/articleView?id=xcloud.os_environment_variables_in_dataraptors_and_integration_procedures_47878.htm&release=264.0.0&type=5 "You can use environment variables to define Default Values and Filter Values, and in Formulas.").

The Set Values action doesn’t support custom labels.

- **[Rename Data JSON Nodes](https://help.salesforce.com/s/articleView?id=xcloud.os_set_values_in_an_omniscript_22132.htm&release=264.0.0&type=5)**  
    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](https://help.salesforce.com/s/articleView?id=xcloud.os_set_values_in_an_omniscript_22132.htm&release=264.0.0&type=5)**  
    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](https://help.salesforce.com/s/articleView?id=xcloud.os_set_values_in_an_omniscript_22132.htm&release=264.0.0&type=5)**  
    Create dynamic values by concatenating JSON node values.
- **[Formulas and Functions with Set Values](https://help.salesforce.com/s/articleView?id=xcloud.os_set_values_in_an_omniscript_22132.htm&release=264.0.0&type=5)**  
    Generate dynamic values by evaluating data with formulas and functions to return specific values.
- **[Set and Access Nested Data](https://help.salesforce.com/s/articleView?id=xcloud.os_set_values_in_an_omniscript_22132.htm&release=264.0.0&type=5)**  
    Set and access nested data by editing the Set Values JSON directly and using specific syntax.

#### See Also

- [Load Data into Omniscript Elements](https://help.salesforce.com/s/articleView?id=xcloud.os_load_data_into_omniscript_elements_21907.htm&release=264.0.0&type=5 "You’ll likely need to pull data into an Omniscript to prefill elements, create selectable options, dynamically display elements, or test your Omniscript. You can use data from Salesforce objects or external and internal sources. Omniscripts use several ways to get this data: Omnistudio Data Mappers, Integration Procedures, REST APIs, or Apex. Users can also add or change data in an Omniscript.")

## 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](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_note.png)

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](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_note.png)
    
    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.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
          <thead class="slds-text-title_caps ">
            <tr><th class="slds-cell-wrap" scope="col" id="d71900e511">ELment name</th>
            <th class="slds-cell-wrap" scope="col" id="d71900e514">Value</th>
          </tr></thead>
          <tbody><tr class="">
            <td class="slds-cell-wrap" data-label="ELment name" headers="d71900e511">Enter a JSON node or element name.</td>
            <td class="slds-cell-wrap" data-label="Value" headers="d71900e514">Click <strong class="uicontrol">fx</strong> and enter multiple merge fields or a combination of
              merge fields and literal values. <p>Example of two merged fields: =%FirstName% + " " +
                %LastName%</p>
              <p> Example of a merged field and literal value: =%FirstName% + " " +
                "Smith"</p>
            </td>
          </tr>
        </tbody></table>

## 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](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_note.png)

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%)`

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small " summary="Examples of Formulas and Functions in Set Values">
          <caption>Examples of Formulas and Functions in Set Values</caption>
          <colgroup>
            <col>
            <col>
          </colgroup>
          <thead class="slds-text-title_caps ">
            <tr class="">
              <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d71900e619">
                <p style="margin-bottom:0;">Example type</p>
              </th>
              <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d71900e625">
                <p style="margin-bottom:0;">Example Value Formula Syntax</p>
              </th>
            </tr>
          </thead>
          <tbody>
            <tr class="">
              <td data-label="Example type" class="slds-cell-wrap" style="vertical-align:top;" headers="d71900e619 ">
                Merge values
              </td>

              <td data-label="Example Value Formula Syntax" class="slds-cell-wrap" style="vertical-align:top;" headers="d71900e625 ">
                <p style="margin-bottom:0;">= %GrossIncome% - %NetIncome%</p>
              </td>

            </tr>
            <tr class="">
              <td data-label="Example type" class="slds-cell-wrap" style="vertical-align:top;" headers="d71900e619 ">
                Merge And literal values
              </td>

              <td data-label="Example Value Formula Syntax" class="slds-cell-wrap" style="vertical-align:top;" headers="d71900e625 ">
                <p style="margin-bottom:0;">= %GrossIncome% - 5000</p>
              </td>

            </tr>
            <tr class="">
              <td data-label="Example type" class="slds-cell-wrap" style="vertical-align:top;" headers="d71900e619 ">
                Literal values
              </td>

              <td data-label="Example Value Formula Syntax" class="slds-cell-wrap" style="vertical-align:top;" headers="d71900e625 ">
                <p style="margin-bottom:0;">= 2 - 2</p>
              </td>

            </tr>
          </tbody>
        </table>

## 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:

```json
"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](https://help.salesforce.com/s/articleView?id=xcloud.os_access_omniscript_data_json_with_merge_fields_22053.htm&release=264.0.0&type=5 "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.").