I just want to ask you all of you. can we use soql query in triggers? when I was searching in google and found that in one article "SOSL is not used in Triggers". while soql is used in triggers. enter image description here


The best place to start and learn about SOQL, SOSL and Triggers is Apex Basics & Database at trailhead.

SOQL can be used in Triggers but SOSL is not. The idea to allow it has been raised away long back. You can upvote it:- Allow SOSL queries in Triggers

SOSL queries are only supported in Apex classes and anonymous blocks. You cannot use a SOSL query in a trigger.

You can get more information here:- Introduction to SOQL and SOSL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.