How to write SOQL Query to Retrieve/Search All Account Contact Relationship records and display account related contacts based on recordId on click button in Lightning Component Salesforce | How to Fetch/Search all the records in related list on Account on click button in Lightning Component Salesforce
Hey guys, today in this post we are going to learn about How to write SOQL Query to Retrieve/Search All Account Contact Relationship records and display account related contacts based on recordId on click button in Lightning Component Salesforce.
Client applications need to be able to query for more than a single type of object at a time. SOQL provides syntax to support these types of queries, called relationship queries, against standard objects and custom objects. Relationship queries traverse parent-to-child and child-to-parent relationships between objects to filter and return results.
Relationship queries are similar to SQL joins. However, you cannot perform arbitrary SQL joins. The relationship queries in SOQL must traverse a valid relationship path as defined in the rest of this section. To know more details about Relationship Queries, Click Here..
Files we used to display Relationship Queries in lightning component →
AccountCmp.cmp
Lightning Component
It is used to display Relationship Queries in lightning component
AccountCmpController.js
JavaScript Controller
It is hold Javascript doInit function to fetch and display list of records.
AccountCmpApp.app
Lightning Application
It is used to call the component and preview on browser.
accCtrl.apxc
Apex Class Controller
It is used for get SOQL query to retrieve Account records.
Final Output → To get source code live demo..
Other related post that would you like to learn in Salesforce
Create Lightning Component
Step 1:- Create Lightning Component : AccountCmp.cmp
From Developer Console >> File >> New >> Lightning Component
AccountCmp.cmp [Lightning Component File]
Create JavaScript Controller
Step 2:- Create Lightning Component : AccountCmpController.js
From Developer Console >> File >> New >> Lightning Component >> JavaScript Controller
AccountCmpController.js [JavaScript Controller]
Create Apex Class Controller
Step 3:- Create Apex Class : accCtrl.apxc
From Developer Console >> File >> New >> Apex Class
accCtrl.apxc [Apex Class Controller]
Create Lightning Application
Step 4:- Create Lightning Application : AccountCmpApp.app
From Developer Console >> File >> New >> Lightning Application
AccountCmpApp.app [Component Application File]
Further post that would you like to learn in Salesforce FAQ (Frequently Asked Questions)
Final Output → To get source code live demo..
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
Originally published at https://www.w3web.net on August 21, 2022.