You need to sign in to do that
Don't have an account?
Ameer Basha 34
How to get data from from a variable which contains list of accounts and more than list of 3 child objects records
Hi Everyone,
As I am new to apex development. I met with a requirement where I have an apex class and i have written a soql query which fetches list of accounts and list of its child records in a variable....There are 4 child objects for accounts....My concern is how to get object wise separate records data from the variable..and set it in wrapper class.I can use for loop inside a for loop but we are minding it as a bad practise with out using nested for loop can any one suggest me any thing..mapping account id to child records is became difficult to me...thanks in Advance....
As I am new to apex development. I met with a requirement where I have an apex class and i have written a soql query which fetches list of accounts and list of its child records in a variable....There are 4 child objects for accounts....My concern is how to get object wise separate records data from the variable..and set it in wrapper class.I can use for loop inside a for loop but we are minding it as a bad practise with out using nested for loop can any one suggest me any thing..mapping account id to child records is became difficult to me...thanks in Advance....
Hi Ameer,
You can refer below code for reference:
In below snippet Child1__c is the object while Child1__r is the relationship name of Child1__c with Account