cross object nested soql queries in salesforce -- w3web.net

How to write a Cross-object (Nested Queries) SOQL query from Parent to child, Retrieve the related list values and display on Lightning Component in Salesforce | how to access child records from parent in salesforce

327 views

Hey guys, today in this post we are going to learn about How to write a Cross-object (Nested Queries) SOQL query from Parent to child, Retrieve the related list data and display on Lightning Component in Salesforce

Files we used in this post example

relationshipQueriesCmp.cmp Lightning Component It is used for create a table for display the Related List Values
relationshipQueriesCmpController.js JavaScript Controller File It is hold Javascript doInit functionality.
relationshipQueriesCmpHelper.js JavaScript Controller Helper File It is hold for Javascript Helper Function to get Nested Queries Values from apex method
relationshipQueriesCtrl.apxc Apex Class Controller It is used for get SOQL query from Parent to child and Retrieve the related list data from Apex Method

Live Demo

cross object nested soql queries in salesforce -- w3web.net

 

Other related post that would you like to learn in Salesforce

 

Create Lightning Component

Step 1:- Create Lightning Component : relationshipQueriesCmp.cmp

From Developer Console >> File >> New >> Lightning Component

relationshipQueriesCmp.cmp [Lightning Component File]

Create Component JavaScript Controller

Step 2:- Create Lightning Component : relationshipQueriesCmpController.js

From Developer Console >> File >> New >> Lightning Component >> JavaScript Controller

relationshipQueriesCmpController.js [JavaScript Controller]

Create Component JavaScript Helper

Step 3:- Create Lightning Component : relationshipQueriesCmpHelper.js

From Developer Console >> File >> New >> Lightning Component >> JavaScript Helper

relationshipQueriesCmpHelper.js [JavaScript Helper File]

Create Apex Class Controller

Step 4:- Create Apex Class : relationshipQueriesCtrl.apxc

From Developer Console >> File >> New >> Apex Class

relationshipQueriesCtrl.apxc [Apex Class Controller]

cross object nested soql queries in salesforce -- w3web.net

Further post that would you like to learn in Salesforce

 


 

FAQ (Frequently Asked Questions)

How do I write a nested SOQL query?

Nested queries—also known as a left outer join relationship—are a top-down approach to creating a SOQL query. A classic example of this would be the standard Account object with many child objects that are unrelated to one another: Opportunities, Contacts, Cases, and Attachments.

How many SOQL nested queries?

There is a limit of 4 External objects that can be joined in SOQL. Joins have a huge performance impact on data processing. You can expect longer response times for each join in a query.

What is inner query in SOQL?

You need the relationship name to perform inner SOQL query. For example, if you are going to perform a query to get Accounts along with their contacts then your query will be something like - Select Id, Name,(Select Id, LastName from Contacts) from Account.

Related Topics | You May Also Like

  • Your reaction of the article ▾
 

Hi, This is Vijay Kumar behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net

3 thoughts on “How to write a Cross-object (Nested Queries) SOQL query from Parent to child, Retrieve the related list values and display on Lightning Component in Salesforce | how to access child records from parent in salesforce”

Leave a Comment