---
schema_version: "1"
id: f401efb44fc9643b24cfbf40708068d0abdc48ca17ff6c71ba38f999d83f60b6
title: Use Formulas in Omnistudio Data Mappers (Managed Package)
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_use_formulas_in_dataraptors.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_use_formulas_in_dataraptors.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 3a5901911d800f222d8139f7fa799b1d09954d22156452fe359e756da7ea97a4
description: For the managed package runtime, to add data to the output of a Data Mapper, define formulas. Several types of Data Mapper (Extract, Transform, and Load) support formulas. When you define a formula, you map its output to the output JSON (for extracts and transforms) or Salesforce object field (for loads).
products:
  - Omnistudio
release: "264"
---
# Use Formulas in Omnistudio Data Mappers (Managed Package)

For the managed package runtime, to add data to the output of a Data Mapper, define _formulas_. Several types of Data Mapper (Extract, Transform, and Load) support formulas. When you define a formula, you map its output to the output JSON (for extracts and transforms) or Salesforce object field (for loads).

![Managed Package app icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/resources-global/_corporate/images/managedpackageicon.png) This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see [Omnistudio Help](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_standard.htm&language=en_US).

For details about the operators and functions that you can use in formulas, see [Function Reference (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_function_reference.htm&release=264.0.0&type=5 "For the managed package runtime, use these operators and functions in Omnistudio Data Mappers and Integration Procedures, and in Vlocity Intelligence, eligibility rules, underwriting rules, state rules, and calculation procedures.").

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/images/icon_note.png)

Note

If a variable name contains spaces or non-alphanumeric characters, enclose the variable name in double quotes and precede it with `var:` in formulas. For example, if the JSON node name is `Primary Guardian`, specify it in formulas as `var:"Primary Guardian"`.

If the name of a custom field includes special characters, sometimes you can't reference the field in a formula.

Before Winter '20, the result of a LIST function in a formula was saved to a `VLOCITY-FORMULA-LIST` node under the **Formula Result Path**. Beginning with Winter '20, the result is saved directly under the **Formula Result Path**.

To create a formula:

1. In the Data Mapper Interface page, go to the **Formulas** tab.
2. Click **Add Formula**. An empty formula is added to the list.
3. In the **Formula** field, specify the desired logic. For example, to determine the total price of the items being purchased by a customer, enter a formula such as:
    
    `SUM(Products:Price)`
    
    You can reference attributes in formulas. Use the code (not the name) preceded by @. For example:
    
    `Account:@GoldStarAccount == "On"`
    
    You can also use relationship notation in formulas to reference fields in a parent object. See [Relationship Notation versus Multiple Extract Steps (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_relationship_notation_versus_multiple_extract_steps.htm&release=264.0.0&type=5 "For the managed package runtime, using relationship notation improves the performance of Omnistudio Data Mappers that retrieve data from a parent of the primary sObject. You use this notation in the Extract JSON Paths for the parent sObject's fields instead of adding a second sObject in the Data Mapper's Extract tab. Two examples illustrate how to use relationship notation.").
4. In the **Formula Result Path** field, specify a JSON node in which to store the formula result.
5. Map the result to the final output.
    - For an Extract Data Mapper, on the **Output** tab, map the formula result to the output structure. Use a colon (:) to delimit levels in the input and output paths in mappings.
    - For a Transform Data Mapper, on the **Transforms** tab, map the formula result to the output structure. Use a colon (:) to delimit levels in the input and output paths in mappings.
    - For a Load Data Mapper, for each sObject that you want to update, on the **Fields** tab, map the formula result to the field that you want to update.
6. Load: For each sObject that you want to update, go to its **Fields** tab and map the formula result to the specific field that you want to update.

- **[Create an Omnistudio Data Mapper Example with a Formula (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_create_a_dataraptor_example_with_a_formula.htm&release=264.0.0&type=5)**  
    For the managed package runtime, the following example accepts a list of prices and uses a formula to compute the total price.