Omnistudio DataRaptors - Load

  • August 19, 2022

This tech article begins by describing the Service Management layer in Omnistudio and then covers Load DataRaptor in detail.

For those who haven’t read the previous article, Omnistudio is a drag-and-drop-based tool based on a what-you-see-is-what-you get model that enables users to implement complex functionalities without writing custom code.

Omnistudio has three layers:

  • Digital Experience layer is more of a UI layer and contains components like Flexcards and Omniscripts.
  • Service Management layer focuses on the back-end processing though DataRaptors and Integration Procedures.
  • Developer Experience layer comes into the picture once development is finished and the focus turns to deployment.

We’ll start with DataRaptors, which is a part of the Service Management layer in Omnistudio.

DataRaptors are basically used to pull data from Salesforce or to update, insert or transform data into Salesforce.

Omnistudio has four types of DataRaptors, each based on function:

  • Extract — use the Extract interface when you need to get data from one or more Salesforce object at the same time when creating a DataRaptor.
  • Turbo Extract — use the Turbo Extract interface when you need to get data from a single Salesforce object.
  • Load — use the Load interface when you need to insert new Salesforce records and update older ones. Load can be in data manipulation language (DML) operations.
  • Transform — use the Transform interface when you need to manipulate data but don’t need to either bring in any data from Salesforce or insert/update data in the org. The Transform interface performs changes in any data already retrieved from the org or coming in from outside Salesforce.

Let’s discuss Load DataRaptors, which are used to create or update records in Salesforce, in more detail.

  • Go to the Omnistudio app
  • From the dropdown, select DataRaptors

Select Dataraptors

  • From the Type dropdown, click New and select the DataYaptor you want to use (this example uses Load)
  • Name the DataRaptor — DR_Load_Practice3
  • Click Save

Give data raptor Name

A new console will open with five subtabs:

  • Objects
  • Formulas
  • Fields
  • Options
  • Preview

New console with 5 subtabs

The Object tab is first, where you can note which objects you need to insert.

object tab

  • Select Contact

Select Contact

  • In the fields, provide the necessary mappings.

Provide the mappings

Input JSON path: lastName

Domain Object Field: LastName

Input Json Path and Domain Object Field

  • Go to the Preview tab and create the JSON input
{
“lastName” : “Bhavya Chanan Omnistudio1”

}

Here’s a simple example of a Load DataRaptor:

Simplest example of a Load dataraptor

You can also insert multiple records at the same time by providing a JSON list in the input JSON.

{
“contacts” : [
  {
“lastName” : “My 1st Contact”
  },
  {
“lastName” : “My 2nd Contact”
}
]
}

Insert multiple records at the same time

  • In the Input Panel of the Fields tab, copy this JSON: input json path —> contacts:lastName
  • Copy this JSON in the input JSON of the Preview tab
  • Click Execute

json in the input json and Execute

You can check the newly created contacts in your org.

Check the newly created contacts

Now let’s look at an example where we insert related records. We’ll insert the Account first, and then its related contact.

Insert the Account

In the Objects tab, select Account first, and the Contact Object; for the Contact Add link use:

Domain Object Field —> AccountId

Linked Object —> 1-Account —> Id

Select Account and the Contact Object

Go to the Fields tab, where you’ll see two subtabs:

Subtabs in the fields

Account: name —- > Name

Name in Account : name

Contact: lastName —- > LastName

LastName in the Contact : lastName

Click Preview, and then provide a simple Input JSON:

{
“name” : “Account new load“,
“lastname” : “contact name new“
}

Simple Input Json

For upserting, click the upsert key checkbox. This action is solely for updating. For the ID field, click Is Required For Upsert.

Check Upsert Key and Is Required For Upsert

Now, you can check the newly created Account and a contact under it.

Check the newly created Account

That’s all it takes to get started with Load Dataraptors.

— By Bhavya Chanan & Sanjeevani Shukla