You are here:
Create an Omnistudio Data Mapper Example with a Formula (Managed Package)
For the managed package runtime, the following example accepts a list of prices and uses a formula to compute the total price.
This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.
To download a data pack of this example for Omnistudio for Managed Packages, click here.
To create this Data Mapper Transform, perform these steps:
- Go the Omnistudio Data Mapper Designer tab and click New. The Create dialog is displayed.
-
Specify a name for the Data Mapper and configure its settings as follows:
-
Interface Type: Transform
-
Input Type: JSON
-
Output Type: JSON
-
- Click Save. The Data Mapper Interface page is displayed.
- Go to the Formulas tab and click Add Formula.
- In the Formula field, enter SUM(Products:Price).
- In the Formula Result Path field, enter TotalPrice.
-
On the Transforms tab, expand the Input JSON pane and paste this JSON structure into it:
{ "CustomerName": "Bob Smith", "Products": [ { "Name": "iPhone", "Price": 600 }, { "Name": "iPhone Case", "Price": 30 }, { "Name": "Ear Buds", "Price": 200 } ] } -
Expand the Expected JSON Output pane and paste this JSON structure into it:
{ "CustomerName": "Bob Smith", "TotalPrice": 830, "Products": [ { "Name": "iPhone", "Price": 600 }, { "Name": "iPhone Case", "Price": 30 }, { "Name": "Ear Buds", "Price": 200 } ] } - Click Quick Match. In the Quick Match window, click Auto Match, then click Save.
-
On the Preview tab, click Execute.
If you have built the example correctly, the JSON structure in the Response pane matches the Expected JSON Output except for the order of the top-level nodes.
-
In the Input pane, change one or more of the prices, then click Execute again.
Note how the
TotalPricevalue changes.
