Skip to main content

Build Data Mapper Extract to Fetch Order Data

Get Started with Data Mappers

Now that you understand the example scenario and customer requirements, it’s time to start building the Omnistudio components. As we mentioned in the previous unit, we start with data mappers in this badge to configure the data integration. Data mappers fetch, load, and transform Salesforce data. You use these data mappers to fetch and update order details, and also fetch external country information.

Here are the data mappers that you’ll build in this badge.

Data Mapper Name

Interface Type

Purpose

DMExtractOrderDetails

Extract

Fetch the order information from the Order object.

DMTransformOrderAndCountryData

Transform

Restructure and map the country data to a format that can be consumed by other components.

DMLUpdateOrderDetails

Load

Load the new shipping address to the Order object.

And here are the additional data mappers provided in the Developer Edition org.

Data Mapper Name

Interface Type

Purpose

DMExtractShippingCountry

Extract

Extract the shipping country name from the Order object after the shipping address is updated.

DMTransformUpdatedCountryData

Transform

Restructure and map the country data to a format that can be consumed by other components.

You use these data mappers in the next badge, where you create and configure the Integration Procedures.

Create a Data Mapper Extract

First, create a data mapper extract to get the order details.

  1. Click App Launcher, then find and select Data Mappers.
  2. Click New.
  3. In the Create New: Data Mapper window, enter these details.
    • Name: DMExtractOrderDetails
    • Interface Type: Extract
    • Input Type: JSON
    • Output Type: JSON
  4. Click Save. The data mapper opens in the Data Mapper Designer in a new tab.
  5. In the Extract tab, click Add Extraction Step. An Extract Object element appears in the designer canvas.
  6. For Extraction Object, find and select Order.
  7. For Extract Object Path, enter Order.
  8. In the Filter section, enter these details.
    • Field: Id
    • Operator: Equals
    • Value: OrderId
Note

All the input data in this badge is case-sensitive. Make sure you enter the same data in the org to pass the challenges.

Data Mappers auto save your work after every change.

Map Input and Output Paths in the Data Mapper Extract

In the previous section, you created a Data Mapper Extract. Next, map the data from the source object to a destination path using the Extract JSON Path and JSON Output Path fields.

If you’ve closed your Data Mapper Extract, click App Launcher, then find and select Data Mappers. In the Data Mappers list view, click DMExtractOrderDetails to open the data mapper in the Data Mapper Designer.

  1. In the Data Mapper Designer, click the Mapping tab.
  2. Click Create Mapping.
  3. On the Create Mapping window, for Extract JSON Path, find and select Order:OrderNumber.
    Notice the Order prefix is added to all the Order object fields. This is because you entered Order as the Extract Object Path earlier. You can give any name for the Extract Object Path.
  4. On the Create Mapping window, for JSON Output Path, enter OrderOutput1.
  5. Click Save & New to add more mappings.
  6. Repeat steps 3 to 5 and add these mapping data. After you enter the last mapping details, click Add on the Create Mapping window.

Extract JSON Path

JSON Output Path

Order:Status OrderOutput2
Order:Shipping_Method__c OrderOutput3
Order:ShippingStreet OrderOutput4
Order:ShippingCity OrderOutput5
Order:ShippingState OrderOutput6
Order:ShippingPostalCode OrderOutput7
Order:ShippingCountry OrderOutput8
Order:Account.Name OrderOutput9
Order:TotalAmount OrderOutput10
Order:ShippingCountryNoSpace__c OrderOutput11

In the Order:Account.Name Extract JSON Path, Account.Name is a lookup field. You're fetching the Account Name from the Account object related to the Order. You won’t find it in the Extract JSON Path dropdown list.

These mappings include two custom fields provided in your org that serve a specific purpose related to the requirement.

  • ShippingCountryNoSpace is a custom field in the Order object that stores the country name without spaces. The URL you use in the Integration Procedure HTTP action can’t include any space. So if there’s a space in the country name, such as the United States, the field uses a formula to add %20 in place of the space. This makes sure the URL is in the correct format.
  • Shipping Method is a custom field in the Order object that captures the shipping method a customer chooses for their delivery timeline requirement. The shipping method field includes these options: Standard, Expedited, and Overnight.

After you create a data mapper, it’s activated by default and is available for you to use. So your DMExtractOrderDetails data mapper is ready.

Test Your Data Mapper

But how do you know whether you’ve configured the data mapper correctly and if it’s fetching the data? Here’s how you can test your data mapper (we won’t check this).

  1. In the Data Mapper Designer, click Preview.
  2. In the Input Parameters section, click Edit as Params.
  3. Click + Add Key/Value.
  4. For Key, enter OrderId.
  5. For Value, enter the record Id of the Order with Order Number 00000101. To get the record Id, perform these steps.
    • Switch to the tab where the Omnistudio app is open or open it in a new tab.
    • Click App Launcher, then find and select Orders.
    • In the Orders list view page, click Dropdown menu beside Recently Viewed and select All Orders.
    • Click 00000101.
    • Copy the record Id from the URL. For example, 801ak00001RLKGiAAP is the record Id in this sample URL. The record Id in your Developer Edition org will be different.

The URL of an Order with the record Id highlighted.

6. Click Execute.

The Data Mapper Designer preview screen showing the results.

In the Response pane, you can see the data mapper has fetched the correct data for each field from the specified order.

What's Next

In this unit, you learned how to create a data mapper extract and configure the input and output mappings. In the next unit, you learn how to create data mapper transform and data mapper load.

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback