You need to sign in to do that
Don't have an account?
Raghubm
String.escapesinglequotes giving error 'no viable alternative at character '\''
Tryring to execute a query byt getting the error 'no viable alternative at character '\' in soql'
String NSP = 'vlocity_cmt__'; String matrixRowQuery = 'SELECT Id, Name, ' + NSP + 'InputData__c, ' + NSP + 'CalculationMatrixVersionId_r.' + NSP + 'Priority_c, ' + NSP + 'CalculationMatrixVersionId_r.' + NSP + 'VersionNumber_c ' + 'FROM ' + NSP + 'CalculationMatrixRow__c WHERE ' + NSP + 'CalculationMatrixVersionId__c = \'' + matrixVersion.Id + '\' AND Name != \'Header\''; matrixRowQuery = String.escapeSingleQuotes(matrixRowQuery);
Can you check the similar question posted in stack exchange.
https://salesforce.stackexchange.com/questions/130238/no-viable-alternative-at-character
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,
String matrixRowQuery = 'SELECT Id, Name, ' + NSP + 'InputData__c, ' + NSP + 'CalculationMatrixVersionId_r.' + NSP + 'Priority_c, ' + NSP + 'CalculationMatrixVersionId_r.' + NSP + 'VersionNumber_c ' + 'FROM ' + NSP + 'CalculationMatrixRow__c WHERE ' + NSP + 'CalculationMatrixVersionId__c = '' + matrixVersion.Id + '' AND Name != 'Header'';
and see if that resolves the issue.