Example for SOSL(Salesforce Object Search Language)

Examples:

FIND {test*} 
IN ALL FIELDS 
RETURNING Account (Id, Name), Contact, Opportunity, Lead

Searches field values starting with the keyword 'test' in all fields in Account, Contact, Opportunity, Lead and displays the result.

FIND {Test} 
IN Name FIELDS 
RETURNING Lead(Name WHERE CreatedDate = THIS_FISCAL_QUARTER LIMIT 10)

Searches Test in Name field in Lead with the condition CreatedDate is this fiscal quarter.


Cheers!!!

2 comments:

  1. in above query if we want to give createddate dynamically then how can we frame this

    ReplyDelete
    Replies
    1. Try Dynamic SOSL - http://www.infallibletechie.com/2016/08/dynamic-soql.html

      Delete