Author: Bhavya Chanan & Sanjeevani Shukla
In this blog we are going to start with the Service Management Layer in Omnistudio and cover Extract DataRaptor in detail.
For those who have not gone through the previous blog,
Omnistudio is a drag n drop based tool based on what you see is what you get model which enables users to implement complex functionalities without writing custom code.
Find the link of the previous blog below to brush up the prerequisite :
Omnistudio has 3 layers.
Digital Experience layer which is more of a UI layer containing components like Flexcards and Omniscripts.
Service Management layer which focuses on the backend processing though DataRaptors and Integration Procedures.
Developer Experience layer comes into picture once we are through with the development and focussing on deployment.
Today we are going to start off with DataRaptors which is a part of Service Management layer of Omnistudio.
DataRaptors are basically used to get the data from Salesforce or update, insert or transform the data in the Salesforce
We have 4 kinds of dataraptors in Omnistudio based on their function:
When one needs to get data from one or more Salesforce objects at the same time , we use Extract as the interface type while creating a Data Raptor
When one needs to get data from a single Salesforce object we can use Turbo Extract as the interface type.
We can insert new Salesforce records and update the older one using Load interface. Load can be to DML operations.
We don’t bring any data from Salesforce nor do we insert or update data in the org using the Transform interface. This special type of Data Raptor is used to manipulate data Thus transform interface performs any changes in the data that has already been retrieved from the org or even any other data coming from outside Salesforce.
Let us learn about Extract DataRaptor in detail which is comparatively more complex and provides more functionalities .
Go to omnistudio app————->From the drop down select dataraptors——->
Click on new from the type dropdown we can select the dataraptor we want to use. For now I will select Extract.
Give data raptor Name – DR_Extract_Practice2
Click on Save.
A new console opens with 5 subtabs:
Extract, Formulas, Output, Options, Preview
In extract we basically add extract steps where we tell the dataraptor what all objects and fields do we need to retrieve.
Add extract step—–> Select Account for object —–> In output path specify the json node under which all retrieved accounts will be showing(accounts)
In filter you can give conditions according to which data needs to be retrieved ( Id <> “$Vlocity.null” )
Here we need to do output mappings also explicitly which determines the output json format of the response.
Extract Json Path – accounts:Name
Output Json Path – account:name
Preview –> Execute ( If we would have given only the name in Output Json Path we would be seeing the output without the account node. So we can
play with this output json format as per our requirement.)
Now lets see how it retrieves data from multiple objects:
Delete the previous extraction step.
Add a new step. Give Account as object —-> accounts, Id <> “$Vlocity.null”
This is to get all accounts.
Lets pull contacts for these accounts
Extract —> Add —> Contact, accounts:contacts, AccountId = accounts.Id (this refers to all account ids fetched in the previous extraction step.)
Add output mappings for the same.
accounts:Name —–> accounts:Name
To add output bindings for contact:
contacts:FirstName —> contacts:FirstName
But here we would be getting two different nodes where we are getting contacts and accounts respectively. It is not giving that nested structure which we need.
To do that , in the extract step under Contact , we had already added our Extract Output
Path as -> accounts:contacts , which would create all contacts nodes under account.
And in the output path , we will add output mappings for contact as given below :
Output – accounts:contacts:FirstName —> accounts:contacts:FirstName
Preview –> Execute
We get the desired output format.
You have a couple of more options. Like you can change the data type of output json path. You can transform the value coming to your required value using
Transform Map Values.
In this right pane Input/Output , you can always look for the json data format .
Extraction Step Json — the format in which the data is coming using the extract step.
Now if you already know how you want your result json to be you can paste it in expected json and click on quick match to map the fields.
You can go for auto match or manually map the fields in quick match through drag n drop.
That’s all for starting with Extract Dataraptors..