Skip to main content

Tempo stimato

Argomenti

Chiedi alla community

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.

  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: DMTransformOrderAndCountryData
    • Interface Type: Transform
    • Input Type: JSON
    • Output Type: JSON
  4. 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.

  1. In the Data Mapper Designer, click the Transforms tab.
  2. Click Create Mapping.
  3. On the Create Mapping window, for JSON Input Path, enter DMGetOrder:OrderOutput1.
  4. On the Create Mapping window, for JSON Output Path, enter OrderNumber.
  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.

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.

  1. In the Data Mapper Designer, click the Formula tab.
  2. Click Add Formula to add a Transform Formula element to the designer canvas.
  3. Click Additional options and select Edit to add the formula details.
  4. In the Formula text field, enter CONCAT("https://th-hoc-earthnations-e1403d711d73.herokuapp.com", Input:flags:png).
  5. In the Formula Result Path, enter FullFlagUrl.

Use a formula to structure the data for Timezones and make them appear sequentially together.

  1. In the Data Mapper Designer, click the Formula tab.
  2. Click Add Formula to add a Transform Formula element to the designer canvas.
  3. Click Additional options and select Edit to add the formula details.
  4. In the Formula text field, enter JOIN(%timezones%, ', ').
  5. 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.

  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: DMLUpdateOrderDetails
    • Interface Type: Load
    • Input Type: JSON
    • Output Type: sObject
  4. Click Save. The data mapper opens in the Data Mapper Designer in a new tab.
  5. In the Objects tab, click Add Load Object. A Load Object element appears in the designer canvas.
  6. 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.

  1. In the Data Mapper Designer, click the Mapping tab.
  2. Click Create Mapping.
  3. On the Create Mapping window, for JSON Input Path, enter OrderId.
  4. On the Create Mapping window, for Domain Object, select 1 - Order from the dropdown menu.
  5. On the Create Mapping window, for Domain Object Field, find and select Id.
  6. Click Save & New to add more mappings.
  7. 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.

Condividi il tuo feedback su Trailhead dalla Guida di Salesforce.

Conoscere la tua esperienza su Trailhead è importante per noi. Ora puoi accedere al modulo per l'invio di feedback in qualsiasi momento dal sito della Guida di Salesforce.

Scopri di più Continua a condividere il tuo feedback