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
mohsin ahmad 11mohsin ahmad 11 

could anyone expalin in detail "List<List<sObject>>"??

explaination required for this?
William TranWilliam Tran
List<List<sObject>> --> a list of a list of objects?

What does that mean and where is that used?
it means you have a list of a list of objects such as a list of account list, contact list, opportunity list

it is use main in SOSL, or also known as global search.  For example when doing a global search on "johnson"

You get a list of accounts, list of contacts, list of opportunities etc match the criteria
 
String searchQuery = 'FIND \'' + searchStr1 + '\' IN ALL FIELDS RETURNING  Account (Id,Name,type),Contact(name,email),Opportunity(name,StageName)';

   List<List <sObject>> searchList = search.query(searchQuery);

   accList = ((List<Account>)searchList[0]);
   conList  = ((List<contact>)searchList[1]);
   optyList = ((List<Opportunity>)searchList[2]);

The example above has List<List<sObject>> of accounts, contacts, and opportunities using the FIND search in SOSL.


As a common practice, if your question is answered, please choose 1 best answer.
But you can give every answer a thumb up if that answer is helpful to you.

Thanks
 
sachinarorasfsachinarorasf
Hi Mohsin,

It means you have a list of objects such as a list of account list, contact list, opportunity list it uses main in SOSL, or also known as global search. For example, when doing a global search on any name You get a list of accounts, list of contacts, list of opportunities, etc accordingly match the criteria.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Sachin Arora
www.sachinsf.com