Getting started with Omnistudio DataRaptors

Getting started with Omnistudio DataRaptors! As most of the people in Salesforce would know by now, OmniStudio offers a modular system of Declarative (Think of Salesforce flows) tools to quickly build Salesforce business solutions.

In this blog, we talk of one of the powerful  tools which is one of the most important block of the Service layer of OmniStudio known as DataRaptors.

Type of OmniStudio DataRaptors

There are 4 types of DataRaptors:

  1. DataRaptor Extract : You can query for Salesforce records using DataRaptor Extract. The cool thing about using DataRaptor extract is you could query on multiple objects (related or un-related) at the same time and get all the resultant records in a JSON format. DataRaptor Extracts also allow you to define formulas and JSON structure in which you would want the records.
  2. DataRaptor Turbo Extract: Similar to DataRaptor extract, you could query for Salesforce object records using DataRaptor Turbo Extract. Unlike DataRaptor Extracts, a DataRaptor Turbo Extract support querying on only one single Salesforce object and have no formula builder in it.
  3. DataRaptor Transform: Dataraptor Transform is used to transform a given JSON structure into another. It also supports formulas for filtering and sorting a given JSON array, and many others.
  4. Dataraptor Load: You could think of Dataraptor load as DML statements in Apex. Dataraptor Load allows you to create/update data in Salesforce.

Getting started with Omnistudio DataRaptors

In this post, we are going to talk of DataRaptor Extract in details with a basic examples. We’ll walk you through steps to configure the DataRaptor Extract for some of the common use cases. Follow the images with sections highlighted in sky blue.

Example of DataRaptor Extract

Get a List of Account records with Annual Revenue greater than $50000

  • Go to the OmniStudio App in you Salesforce Org and click on OmniStudio DataRaptors. You would see a list of DataRaptors already existing in your org. Click on New
Example of DataRaptor Extract
  • Once you click on New to create your own DataRaptor, it will launch a pop-up window which would ask you to fill the details of the DataRaptor including its name and type. For this scenario, we’re going to name our DataRaptor Extract as FetchAccountDetails and Interface type would be Extract. We’d let the input and Output Type be JSON. Click on Save.
  • On the Extract tab, we define the query.
    1. Click on the Object dropdown and Select object as Account.
    2. Extract Output Path is the name of the JSON node that will contain your results. You could name it as anything you wish to, the best practice is to name it the same as the Object name. In this case, we are going to enter Extract Path as AccountDetails’.
    3. Filter is the field of object name, used along with operators and values, builds the WHERE clause of your SOQL query. You could enter or select any field of the Object from the dropdown based on your requirements of a filter criteria. For this scenario, we would be selecting AnnualRevenue’ as filter, ‘> as operator and 50000’ as its value.

Note: Relationship fields are supported in filter. However, You would need to enter them yourself, for example Account.Name, Opportunity.Account.Name etc.

  1. Go to the Output tab where we define input and output JSON paths. Click on Extract JSON path field. You would see a dropdown of extract paths in the format of ‘ExtractOutputPath:FieldName’.  These denote the fields you want to query from the object. Let us select ‘AccountDetails:Id’. Enter an Output JSON path which defines the structure of the JSON output. For now, we would enter Output JSON path same as Extract JSON path ‘AccountDetails:Id’. Repeat the steps for other fields on Account object like Name, AnnualRevenue, Industry etc.
  • Let’s now go to Preview tab and click on ‘Execute’.

You would now see the results of your SOQL query that you configured using a DataRaptor Extract. Observe how the output JSON is according to the mapping we earlier defined.

Getting started with Omnistudio DataRaptors

To the right, in the Debug Log panel, you could see the SOQL query that got generated as a result of our Dataraptor Configuration.

Go back to the output tab and try changing some of the Output JSON path names and execute your DataRaptor again to see how it impacts the JSON structure.

Summary

I am sure this blog helped you get introduced to DataRaptors. We would soon cover many other aspects of DataRaptor like executing  multiple object queries, passing dynamic values, using formula etc.

priyadarshi vishal
priyadarshi vishal

Priyadarshi Vishal has close to 5 years of experience working on Salesforce platform. He currently works as Senior Software Engineer with the Product Development Team at CRMantra Technologies, specializing in development with OmniStudio and Salesforce Industries CPQ. He holds multiple certifications in Salesforce & Vlocity. He is an avid reader and likes to challenge himself in learning new skills.

Articles: 3

Leave a Reply

Your email address will not be published. Required fields are marked *