Activity Forums Salesforce® Discussions could anyone explain in detail \"List<List<sObject>>" in Salesforce?

  • could anyone explain in detail \"List<List<sObject>>" in Salesforce?

    Posted by Sumit on January 17, 2020 at 11:15 am

    could anyone explain in detail "List<List<sObject>>" use in sosl??

    • This discussion was modified 4 years, 2 months ago by  Sumit kumar.
    • This discussion was modified 4 years, 2 months ago by  Sumit kumar.
    • This discussion was modified 4 years, 2 months ago by  Sumit kumar.
    • This discussion was modified 4 years, 2 months ago by  Sumit kumar.
    MOHIT replied 4 years, 2 months ago 3 Members · 2 Replies
  • 2 Replies
  • Arun

    Member
    January 17, 2020 at 12:46 pm

    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 any name

    You get a list of accounts, list of contacts, list of opportunities etc accordingly match the criteria.

  • MOHIT

    Member
    January 17, 2020 at 2:57 pm

    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.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos