Query Multiple Objects with Omnistudio DataRaptors : priyadarshi vishal

Query Multiple Objects with Omnistudio DataRaptors
by: priyadarshi vishal
blow post content copied from  Apex Hours
click here to view original post

In this blog, we are going to talk about how we can query multiple Objects in Salesforce using Omnistudio Dataraptors with an example. We’ll walk you through steps to configure the DataRaptor Extract for this use case. Follow the images with sections highlighted in sky blue.

If you are new to OmniStudio then check out our FREE OmniStudio Training and Getting started with Omnistudio DataRaptors post.

Get all the related Contacts and Cases under an Account record

Let’s say you have an Account called “Acme” in our Salesforce org and you would want to retrieve some related information to this Account like it’s Contacts and Cases.

  • Go to the OmniStudio App in your Salesforce Org and click on OmniStudio DataRaptors. You would see a list of DataRaptors already existing in your org. Click on New.
  • 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 GetAccountAndRelatedInfo and the 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.
    • Click on the Object dropdown and Select object as Account.
    • Enter the Extract Path as AccountAndRelatedDetails’.
    • Define the Extract steps as shown below
Query Multiple Objects with Omnistudio DataRaptors
  • The first extract step here refers to the Query to be done to get the Account record where we need to pass AccountName as input.
  • The second extract step is to get all the contacts related to the Account and so we have a filter as Contact has a lookup to Account object using the field “AccountId”
  • Similarly, The final extract step is to get the cases related to the Account.
  • Next step is to configure the Output to define only those fields from the object that we need. Configure them as shown below
Omnistudio DataRaptors field mapping
  • Notice the “Account.Name” and “Contact.Name” in Extract path. You could use SOQL relationship notation to get parent object fields like this. For example, for Extracts defined on Custom objects, use the ExtractPath:LookupFieldName__r.ParentObjectFieldName__c. Also, you could choose different Output path names if you wish to.
  • Let’s go to Preview tab and provide the input AccountName as “Acme” and hit on “Execute” to see the results.
Query Multiple Objects DataRaptors result

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

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

Hope this would help you cover scenarios where you need to query multiple objects in Salesforce using a Dataraptor Extract.

The post Query Multiple Objects with Omnistudio DataRaptors appeared first on Apex Hours.

September 05, 2022 at 06:30PM
Click here for more details...

The original post is available in Apex Hours by priyadarshi vishal
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.