function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sree SalesforceSree Salesforce 

can any one give the suggestion one method i want to get three object s data .I.e getlistfields() method in this i want to get account and contact and opportunity dat

Nagarjuna ReddyNagarjuna Reddy
Try this way.. writting inner SOql 

List<Account> a = [Select Name,(Select FirstName,LastName from
Account.Contacts) From Account where Name='Account1'];
Vatsal KothariVatsal Kothari
Hi,

You can try this:


List<Account> accList = [select id, name,(select Name,FirstName,LastName from Contacts),(Select id,Name from Opportunities) from Account];
   for(Account acc: accList){
      System.debug('Account'+acc);
      for(Opportunity opp : acc.Opportunities){
	   System.debug('Opportunity'+opp);
      }
      for(Contact con : acc.Contacts){
	   System.debug('Contact'+con);
      }
   }

Thanks,
Vatsal
Akshay DeshmukhAkshay Deshmukh
Hi,
you can create wrapper class. and have account,contact and opportunity as members. and then create list of wrapper records