Activity Forums Salesforce® Discussions Can we write sosl in triggers in salesforce?

  • Suraj

    Member
    April 24, 2017 at 12:37 pm

    Hi Saurabh,

    Yes, you can write SOSL inside triggers.There is no such restriction.

    You can test using the following Code in your Org.
    trigger trg_AccountSOSL on Account (before insert, before update) {
    List<List<SObject>> searchList = [FIND 'map*' IN ALL FIELDS RETURNING Account (Id, Name), Contact, Opportunity, Lead];
    List<account> myAcc = ((List<Account>)searchList[0]);
    system.debug(myAcc[0].name);
    }

Log In to reply.

Popular Salesforce Blogs

Salesforce Marketing Cloud Integration with Google Analytics 360

Redefining the future of Marketing – Salesforce Marketing Cloud Integration with Google Analytics 360

Blog in

Know your customers better and make smarter, insight-based marketing decisions through Salesforce’s massive customer relationship management platform twinned with Google Analytics 360’s market-leading digital analytics solution…

Popular Salesforce Videos