function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdc18sfdc18 

Content cannot be displayed: line 1:118 no viable alternative at character '\'

Hi,

I am getting below error on visualforce page for find query.
Please suggest the changes which I need to make in order to work with below code.

Error -- Content cannot be displayed: line 1:118 no viable alternative at character '\'


String parentIdWhereClause = parentCaseId != null ?  'AND Id <> \''+ parentCaseId +'\'': '';

string casesubjectSearch = caseSubject.replace(' ', ' OR ');

string sosl = 'FIND :casesubjectSearch IN ALL FIELDS RETURNING Case(id,CaseNumber, Subject where RecordTypeId =:recordtype '+String.escapeSingleQuotes(parentIdWhereClause)+' ORDER BY LastModifiedDate DESC) LIMIT 100';
List<List<case>> searchList = search.query(sosl);
Best Answer chosen by sfdc18
Shweta_AgarwalShweta_Agarwal
Hi,
Just remove String.escapeSingleQuotes from your code.
string sosl = 'FIND :casesubjectSearch IN ALL FIELDS RETURNING Case(id,CaseNumber, Subject where RecordTypeId =:recordtype '+parentIdWhereClause+' ORDER BY LastModifiedDate DESC) LIMIT 100';