Skip to main content

Transform External Data

Learning Objectives

After completing this unit, you’ll be able to:

  • Build a DataRaptor Transform.
  • Add a DataRaptor Transform to your Integration Procedure.

Build a DataRaptor Transform

In the previous unit, you learned how to trim the weather JavaScript Object Notation (JSON) to share only the “data” node. Great, right? But what do you do when that data isn’t in the format you want to send to your FlexCard or OmniScript? For example, the city and state are on separate lines, and most people prefer to see them together on one line. A DataRaptor Transform helps you manipulate the JSON before you share it. Let’s explore how the tabs in this DataRaptor help you do this.

Define formulas in the Formulas tab to add or manipulate data to the output of a DataRaptor. Most types of DataRaptors—Extract, Transform, and Load—support formulas.

Use the Formulas tab to create the Formula and specify where it is stored.

Use the Formula field (1) to specify the desired logic. In this example, you create a formula to concatenate (join together) the city_name and state_code using the CONCAT function.

In the Formula Result Path field (2), specify a JSON node for storing the formula result. Here, the concatenated value is stored in the Current:city_name node.

You map data in the Transforms tab in one of two ways.

  • Use Quick Match to match up values from input JSON with output JSON.
  • Specify each mapping individually.

Transforms tab in a DataRaptor Transform.

In the Input JSON Path field (1), specify the input path, and in the Output JSON Path field (2), specify the desired output path. For both, use colons to create sub-nodes. For example, Current:Condition and Current:TempF put Condition and TempF in the Current node, but CurrentIcon will be in the root. Match the Expected JSON Output (3) to the Output Path and the Input JSON (4) to the Input Path.

Use the Preview tab to test the output of the DataRaptor. 

The Input and Response panes in the Preview tab.

In the Input (1) pane, specify the sample input, and click Execute. The Response pane (2) displays the results.

Now that you have your DataRaptor Transform, you’re ready to add it to your Integration Procedure.

Add a DataRaptor Transform to an Integration Procedure

When you are working in an Integration Procedure, successfully adding a DataRaptor Transform requires three components.

  • You need a DataRaptor Transform to transform the data.
  • You need a DataRaptor Transform Action element to use the DataRaptor in your Integration Procedure.
  • You need to configure a Response Action element to send the transformed data back to a FlexCard or OmniScript.

Add the DataRaptor Transform Action element to the Structure.

Drag a DataRaptor Transform Action element (1) from the Available Components pane and name it after your newly created DataRaptor Transform (2).

Additional Input/Output/Failure Response section.

Under the Additional Input/Output/Failure Response section, select Send Only Additional Input (1). Then, add two Additional Input keys (2) and their values. This sends the JSON output from the HTTPGetCurrentWeather element to the DataRaptor on a node named Current, and the JSON output from the HTTPGetForecastWeather element to the DataRaptor on a node named Forecast.

Finally, make sure your Response Action sends the JSON that the DataRaptor Transform returns by entering the name of the DataRaptor Transform element in the Send JSON Path field of the Response Action element. 

Remember, if you are extracting data from an external source and need to change it to a format of your choice, then a DataRaptor Transform is your go-to tool and an Integration Procedure is where you should use it!

Partagez vos commentaires sur Trailhead dans l'aide Salesforce.

Nous aimerions connaître votre expérience avec Trailhead. Vous pouvez désormais accéder au nouveau formulaire de commentaires à tout moment depuis le site d'aide Salesforce.

En savoir plus Continuer à partager vos commentaires