You need to sign in to do that
Don't have an account?

Invalid character '*' found in the filter value "%*%" used with the "like" operator.
Hey Guys,
My query is returning this error when I search using * . Other characters are fine.
System.UnexpectedException: Invalid character '*' found in the filter value "%*%" used with the "like" operator.
Here's the part of the query that's causing the error:
qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.Description like \'%' + searchString + '%\' or Product2.Family like \'%' + searchString + '%\' )';
Does anyone know how I can update it to allow asterics * ??
Thanks
In SOQL , LIKE operator support Only % and _ wildcards. As "*" is not supported in Like , you are facing the error.
For more details on comparison operators supported:
https://www.salesforce.com/us/developer/docs/dbcom_soql_sosl/Content/sforce_api_calls_soql_select_comparisonoperators.htm
Thanks,
Pratik
P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
All Answers
In SOQL , LIKE operator support Only % and _ wildcards. As "*" is not supported in Like , you are facing the error.
For more details on comparison operators supported:
https://www.salesforce.com/us/developer/docs/dbcom_soql_sosl/Content/sforce_api_calls_soql_select_comparisonoperators.htm
Thanks,
Pratik
P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
Thanks Pratik,
I ended up having to replace the * for a 0 which isn't ideal.
I was confused because the standard product search accepts * as long as it has other characters. Aparently this is because it is Oracle based and has different rules.
Yes "*" is considered as wildcard character in search but LIKE operator doesn't support it.
Thanks,
Pratik