We can't use SoSL in Triggers Because the apex developer's guide says so-
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.
hi, Sorry ,Earlier this was not allowed but now sosl are allowed in triggers I read wrong content about this https://developer.salesforce.com/forums/?id=906F00000008yZiIAI It was a issue before that we can not have SOSL inside trigger ,However you can write SOSL inside trigger now .This is implemented in Spring 11 .So you can write SOSL inside trigger .
We can't use SoSL in Triggers Because the apex developer's guide says so-
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.
Thanks
Rupal Kumar
Mirketa Software Pvt Ltd
http://mirketa.com/index.html
Hi Rupal,
Sorry; but can you tell on which page of apex developer's guide, it is mentioned? As long as I know there is no such restriction.
Thanks,
Abhishek
Sorry ,Earlier this was not allowed but now sosl are allowed in triggers I read wrong content about this
https://developer.salesforce.com/forums/?id=906F00000008yZiIAI
It was a issue before that we can not have SOSL inside trigger ,However you can write SOSL inside trigger now .This is implemented in Spring 11 .So you can write SOSL inside trigger .
Thanks
Rupal Kumar
Mirketa Software Pvt Ltd
http://mirketa.com/index.html