Using SObjectAccessDecision Class to Call one apex method from another method with two different controller and Passing multiple parameters value from one function to another and displaying cross object related record in lightning component Salesforce | calling multiple apex method and showing data from inner (Nested) soql query in lightning component Salesforce

Vijay Kumar
4 min readOct 5, 2021

Hey guys, today in this post we are going to learn about How to Use SObjectAccessDecision Class to Call one apex method from another method with two different controller and Passing multiple parameters value from one function to another and displaying cross object related record in lightning component Salesforce.

What is SObjectAccessDecision Methods in Salesforce

Contains the results of a call to the Security.stripInaccessible method and methods to retrieve those results.

Find the following are methods for SObjectAccessDecision.

  • getModifiedIndexes()
    Returns the indexes of sObjects that are modified by the stripInaccessible method.
  • getRecords()
    Returns a list of new sObjects that are identical to the source records, except that they are stripped of fields that fail the field-level security check for the current user.
  • getRemovedFields()
    Returns a map of sObject types to their corresponding inaccessible fields. The map key is a string representation of the sObject type. The map value is a set of strings, which denote the fields names that are inaccessible.

➡ To know more details about SObjectAccessDecision Methods, Click Here

Real time scenarios:- Call multiple apex method Uses of SObjectAccessDecision Class (decision) and display data from inner (Nested) soql query (Opportunity and Report_Cards__c) sObject if Opportunity StageName will be match as “Needs Analysis” in Salesforce.

Files we used to Call Multiple Apex Methods in aura component controller in Salesforce

crossMethodCmp.cmp

Lightning Component

It is used to create a table for Iterate the related list (nested query) of custom object on lightning component

crossMethodCmpController.js

JavaScript Controller File

It is hold Javascript Init function to get the data from inner (Nested) soql query in lightning component.

crossMethodCmpHelper.js

JavaScript Helper File

It is hold Javascript Helper Function to get multiple apex method from lightning controller.

crossMethodCtrl.apxc

Apex Class Controller

It is used to fetch the opportunity record based on record Id.

opportunityItemCtrl.apxc

Apex Class Controller

It is used to fetch the opportunity and Report_Cards__c sObject record based on opportunity record Id.

constantsCtrl.apxc

Apex Class Controller

It’s store the diffrent type of string type value for re-reuse to multiple apex method.

Object:- Opportunity

Fields Name:- Name, StageName, CloseDate, Amount

Custom related Object and their fields:-

Object Name:- Report_Cards__c

Fields Name:- Id, Name, Opportunity__c

Final Output To get source code live demo, Click Here..

Other related post that would you like to learn in lightning component.

Create Lightning Component

Step 1:- Create Lightning Component : crossMethodCmp.cmp

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

crossMethodCmp.cmp [Lightning Component File]

Create JavaScript Controller

Step 2:- Create Lightning Component : crossMethodCmpController.js

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

crossMethodCmpController.js [JavaScript Controller]

Create JavaScript Helper

Step 3:- Create Lightning Component : crossMethodCmpHelper.js

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

crossMethodCmpHelper.js [JavaScript Helper File]

Create Apex Class Controller

Step 4:- Create Apex Class : crossMethodCtrl.apxc

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

crossMethodCtrl.apxc [Apex Class Controller]

Create Apex Class Controller

Step 5:- Create Apex Class : opportunityItemCtrl.apxc

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

opportunityItemCtrl.apxc [Apex Class Controller]

Create Apex Class Controller

Step 6:- Create Apex Class : constantsCtrl.apxc

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

constantsCtrl.apxc [Apex Class Controller]

Further post that would you like to learn in LWC Create a Flyout Account, It will help you to grow make more money for a better living.

List your blog on Flyout and start making money for publishing sponsored content on your blog. Here’s the invite link. Get Started for Free

Check Out:- Earn Unlimited Everyday With This Trick:- Click Here

FAQ (Frequently Asked Questions)

Final Output To get source code live demo, Click Here..

Hi, This is Vijay 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 October 5, 2021.

--

--