Activity Forums Salesforce® Discussions What is SOSL query ? How it works?

  • Radhakrishna

    Member
    July 17, 2017 at 4:48 am

    Hello Shariq,

    SOQL statements evaluate to a list of sObjects, a single sObject, or an Integer for count method queries.

    This may help you:

    https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL.htm

  • absar ahmad

    Member
    July 17, 2017 at 9:30 am

    1 - SOSL stand for "Salesforce Search Language" and it is used to search  the  field in all the object or in particular object

    2 - SOSL return List<List<sObject>>

    3 - SOSL search in four field (id,name,email,phone)

    4- Syntax like that  --> " Find {keyword} in ALL FIELD Returning Object_name "  (its for salesforce query editor)

    5 - (for apex) --> " List<List<sObject>> obj = [FIND  'keyword' IN ALL FIELD RETURNING ACCOUNT(name,email) , CONTACT(firstName,phone) ];

     

  • Parul

    Member
    September 16, 2018 at 5:03 am

    Salesforce Object Search Language (SOSL) is a simple language for searching across all multiple persisted objects simultaneously.

    Sosl statements evaluate to a list of SObjects where each list contains the search results for a particular sobject type.
    SOSL queries are only supported in apex classes and anonymous blocks.
    We can not use a SOSL query in trigger.

    EX:-
    The following example that searches all fields across all account and contact objects.

    List<List< Sobject>> searchList = [FIND ‘Text*’  IN ALL FIELDS RETURNING Account,Contact];
    system.debug(‘searchlist is :’+searchList );

     

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos