Query Multiple Objects with Omnistudio DataRaptors
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.

Query Multiple Objects with Omnistudio DataRaptors

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.

Share this article

Leave a reply

Keep in Touch

Subscribe for Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 3,229 other subscribers

Search

Our Supporter

RECENT POSTS

Apex Hours

Apex Hours is one stop platform to learn Salesforce skills and technology

Join our Newsletter and get tips and tricks how to explore the salesforce for free!