Adam Arrowsmith

February 2016 Release Deep Dive: Salesforce Connector Query Relationships

Blog Post created by Adam Arrowsmith Employee on Feb 29, 2016

A subtle but notable enhancement to the Salesforce Connector's query capabilities was delivered in the February 2016 release that can simplify configuration and improve performance of processes involving multiple related objects. Specifically, when importing a Query operation and choosing related parent/child objects, you can now select parents of child objects.


Previously when importing a query operation you could select parent and child objects related to the "main object" (the one you initially chose for import) like this:


sfdc rel tree before.png


Now you can additionally select parents of children like this:


sfdc rel tree after.png


Why is this notable? It means you now the ability to query more of the data you need up front, instead of having to make additional calls later in the process.


For example, a very common use case is querying opportunities along with its associated products to sync to another system as cohesive transaction. If you are familiar with the Salesforce data model you know this actually involves three objects*, Opportunity, OpportunityLineItem, and Product2, related like this:


sfdc opp data model.png


* Four if you also count PricebookEntry, however as of v30 a Product2Id lookup field was added directly to OpportunityLineItem for convenience.


This enhancement allows you to select all three objects in the initial query and returned within a single cohesive document. Previously, because you could not join to Product2 in the initial query, you had to make a subsequent call using a map function to retrieve the product information such as name and external ID.


This enhancement simplifies the process, is more intuitive, and more performant by avoiding the additional API calls.


sfdc parents of children.jpg