SOSL statements evaluate to a list of lists of sObjects, where each list contains the search results for a particular sObject type. The result lists are always returned in the same order as they were specified in the SOSL query. SOSL queries are only supported in Apex classes and anonymous blocks.You cannot use a SOSL query in a trigger.
--- snip ---
If this is something you want to see, its better to create or promote an idea than post here.
SOSL statements evaluate to a list of lists of sObjects, where each list contains the search results for a particular sObject type. The result lists are always returned in the same order as they were specified in the SOSL query. SOSL queries are only supported in Apex classes and anonymous blocks.You cannot use a SOSL query in a trigger.
--- snip ---
If this is something you want to see, its better to create or promote an idea than post here.
This is an error in the docs. You can use SOSL in triggers.
We will be updating the docs in Winter '13 to remove this incorrect statement. Sorry about that. Btw, this SOSL restriction was enforced in in the past but not any longer since Spring '11.
Because the apex developer's guide says so:
--- snip ---
All Answers
Because the apex developer's guide says so:
--- snip ---
Hi Bob,
I am not sure what I am missing but I just tried an SOSL in trigger. It works fine I didnot see any issue.
Please confirm if it is because of any salesforce release.
Thanks,
Lakhan
The docs still say that you can't use a SOSL query in a trigger - do you get any results when you execute it?
I'd raise that as a case with salesforce - sounds like the docs are wrong.
Did somebody raise a case for this? Are the docs wrong as i can use sosl in triggers as well.
This is an error in the docs. You can use SOSL in triggers.
We will be updating the docs in Winter '13 to remove this incorrect statement. Sorry about that. Btw, this SOSL restriction was enforced in in the past but not any longer since Spring '11.
Thanks for letting us know!