Transform Input Data and Load Order Data to Salesforce
Create a Data Mapper Transform
Now that you have data from your data mapper extract, you can use a data mapper transform to restructure or format your input data. Let’s use it to restructure the order and external country data.
Here’s how you create the data mapper transform.
- Click
, then find and select Data Mappers.
- Click New.
- In the Create New: Data Mapper window, enter these details.
- Name:
DMTransformOrderAndCountryData
- Interface Type: Transform
- Input Type: JSON
- Output Type: JSON
- Name:
- Click Save. The data mapper opens in the Data Mapper Designer in a new tab.
Next, add easy-to-understand names to the input data coming from the data mapper extract and country data coming from the external website via the integration procedure you’ll build later. Use mapping to structure all the data into a proper format that’s easy to refer to while configuring the workflow.
- In the Data Mapper Designer, click the Transforms tab.
- Click Create Mapping.
- On the Create Mapping window, for JSON Input Path, enter
DMGetOrder:OrderOutput1.
- On the Create Mapping window, for JSON Output Path, enter
OrderNumber.
- Click Save & New to add more mappings.
- Repeat steps 3 to 5 and add these mapping data. After you enter the last mapping details, click Add on the Create Mapping window.
JSON Input Path |
JSON Output Path |
|---|---|
DMGetOrder:OrderOutput2 |
OrderStatus |
DMGetOrder:OrderOutput3 |
ShippingMethod |
DMGetOrder:OrderOutput4 |
ShippingStreet |
DMGetOrder:OrderOutput5 |
ShippingCity |
DMGetOrder:OrderOutput6 |
ShippingState |
DMGetOrder:OrderOutput7 |
ShippingPostalCode |
DMGetOrder:OrderOutput8 |
ShippingCountry |
DMGetOrder:OrderOutput9 |
AccountName |
DMGetOrder:OrderOutput10 |
OrderAmount |
Input:name:common |
CountryName |
Input:capital |
Capital |
FullFlagUrl |
FlagUrl |
Input:region |
Region |
Input:timezones |
Timezones |
Input:maps:googleMaps |
GoogleMapsUrl |
Use a formula to fetch the country flag image.
- In the Data Mapper Designer, click the Formula tab.
- Click
to add a Transform Formula element to the designer canvas.
- Click
and select Edit to add the formula details.
- In the Formula text field, enter
CONCAT("https://th-hoc-earthnations-e1403d711d73.herokuapp.com", Input:flags:png).
- In the Formula Result Path, enter
FullFlagUrl.
Use a formula to structure the data for Timezones and make them appear sequentially together.
- In the Data Mapper Designer, click the Formula tab.
- Click
to add a Transform Formula element to the designer canvas.
- Click
and select Edit to add the formula details.
- In the Formula text field, enter
JOIN(%timezones%, ', ').
- In the Formula Result Path, enter
Timezones.
The data paths in the JSON Input Path column are configured in the Order and Country Data Processing with Omnistudio Integration Procedure, which you’ll create in the next badge. For example, in the DMGetOrder:OrderOutput2 path, DMGetOrder is the name of the data mapper extract action in the Integration Procedure. OrderOutput2 is the output from the data mapper extract you configured earlier. The Input:[path] data is coming from the HTTP action in the Integration Procedure. The HTTP action uses the external website URL to fetch the country information.
Right now, let’s create a data mapper load.
Create a Data Mapper Load
A data mapper load updates data into one or more Salesforce objects. In this example, you use a data mapper load to update the shipping details of an order.
- Click
, then find and select Data Mappers.
- Click New.
- In the Create New: Data Mapper window, enter these details.
- Name:
DMLUpdateOrderDetails
- Interface Type: Load
- Input Type: JSON
- Output Type: sObject
- Name:
- Click Save. The data mapper opens in the Data Mapper Designer in a new tab.
- In the Objects tab, click
. A Load Object element appears in the designer canvas.
- For Select Object, find and select Order.
Next, map the input data from the JSON input path coming from the Omniscript to a destination object field.
- In the Data Mapper Designer, click the Mapping tab.
- Click Create Mapping.
- On the Create Mapping window, for JSON Input Path, enter
OrderId.
- On the Create Mapping window, for Domain Object, select 1 - Order from the dropdown menu.
- On the Create Mapping window, for Domain Object Field, find and select Id.
- Click Save & New to add more mappings.
- Repeat steps 3 to 6 and add these mapping data. After you enter the last mapping details, click Add on the Create Mapping window.
JSON Input Path |
Domain Object |
Domain Object Field |
|---|---|---|
UpdatedShippingMethod |
1 - Order |
Shipping_Method__c |
UpdatedShippingCountry |
1 - Order |
ShippingCountry |
UpdatedStatus |
1 - Order |
Status |
UpdatedShippingCity |
1 - Order |
ShippingCity |
UpdatedShippingState |
1 - Order |
ShippingState |
UpdatedShippingPostalCode |
1 - Order |
ShippingPostalCode |
UpdatedShippingStreet |
1 - Order |
ShippingStreet |
Your DMLUpdateOrderDetails data mapper is now ready. You’ll configure the JSON input paths in the Omniscript later in the Order Data Modification with Omnistudio Omniscripts badge.
Wrap Up
In this badge, you learned about the example scenario and the customer requirements. You got an overview of the scenario workflow and the things you do as part of this badge series. You also learned how to build data mappers to fetch, transform, and update order data.
But you’re not done yet. Complete the Order and Country Data Processing with Omnistudio Integration Procedures badge to learn how to create Integration Procedures to perform data operations and serve the data to Flexcards and Omniscript.