You need to sign in to do that
Don't have an account?
SOSL Help needed: System.QueryException: unexpected token: FIND
Hi!
The the same query that works in the workbench fails running in Salesforce:
System.QueryException: unexpected token: FIND
Any help is appreciated!
Thanks!
Laura
The object eci_HTTPEventLog__c contains the following:
eci_HTTPEventLog__c.response__c = '<Envelope><Body><RESULT><SUCCESS>true</SUCCESS<SESSIONID>349557C0E497DDFC154379B4DF528057</SESSIONID><ORGANIZATION_ID>5872ae98-1341ac53619-d7c8ec57ae636c7258d3eb0ef0e531f2</ORGANIZATION_ID<SESSION_ENCODING>;jsessionid=349557C0E497DDFC154379B4DF528057</SESSION_ENCODING</RESULT></Body></Envelope>';
String response = '';
String queryString = 'FIND {jsessionid} IN ALL FIELDS RETURNING eci_HTTPEventLog__c'; // fails here
for (LIST<SObject> sobj : database.query(queryString)) {
for (SObject objs : sobj) {
if (objs.getSObjectType() == eci_HTTPEventLog__c.sObjectType)
{
eci_HTTPEventLog__c event = (eci_HTTPEventLog__c) objs;
response = event.response__c;
}
}
}
Use search.query() instead of database.query(), as the latter expects a SOQL query, not SOSL.
Example: