You need to sign in to do that
Don't have an account?
Soql query error during special character search
Hi I have 2 SOQL queries, both are used for search.
First query is working fine, i.e.
select FirstName,LastName,Title,Street,Company,LeadSource,Email,Owner.Name,Rating FROM Lead where Createddate < LAST_WEEK AND
Status = 'Open' AND (Rating ='Hot (Probably Order)' OR RecordTypeId IN
('012800000007S5iAAE','012800000007IumAAE','01280000000LmL3AAK','012800000007TxvAAE')) and (FirstName like 'Kevin(%'or LastName
like 'Kevin(%'or Company like 'Kevin(%'or LeadSource like 'Kevin(%'or Email like 'Kevin(%'or Owner.Name like 'Kevin(%'or Rating
like 'Kevin(%'or Street like 'Kevin(%'or Title like 'Kevin(%') order by FirstName asc NULLS FIRST
Second one is giving error like "Invalid character found in the filter value "Kevin(%" used with the "like" operator."
the second query is below
select FirstName,LastName,Title,Street,Company,LeadSource,Email,Owner.Name,Rating FROM Lead where Createddate < LAST_WEEK AND
Status = 'Open' and (FirstName like 'Kevin(%'or LastName like 'Kevin(%'or Company like 'Kevin(%'or LeadSource like 'Kevin(%'or
Email like 'Kevin(%'or Owner.Name like 'Kevin(%'or Rating like 'Kevin(%'or Street like 'Kevin(%'or Title like 'Kevin(%') order
by FirstName asc NULLS FIRST
Can any one help me to find out the error?
Thanks in advance.
I got the answer. I update the api version of the class from 20 to 27. and it is working fine. Thank you.
All Answers
Hi Tech Force, Thank you for your reply. I have data like "Kevin( asc@#$%^&*)". I know this a test data, but original record might have some data with special characters. so I want to write some logic where user can give search string with special character like "Kevin( asc@#" and get the matching data.
Like
String nameVal = 'Kevin( asc@#$%^&*)' + %;
where Name Like: nameVal
I got the answer. I update the api version of the class from 20 to 27. and it is working fine. Thank you.