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
amarnijeramarnijer 

Soql Like query does not search records where data contains character like (,),{,},[,]

Hi I have written a soql query like below.

 

SELECT ID,Name,
Dodge_Report_Number__c,Project_Name__c,Bid_Date__c,GC_Awarded__c,Action_Stage__c,Target_Start_Date__c,Project_Valuation_High__c,Pro
ject_Valuation_Low__c,Type_Of_Work__c,Removed_By__r.Name, Removed_By__r.LastName
,Removed_By__r.FirstName,Reason_Removed_Comments__c,Reason_Why_Project_Removed__c,Branch_ID__c FROM Dodge_Project__c WHERE
Branch_ID__c != null AND CreatedDate >= LAST_QUARTER AND CreatedDate <= THIS_QUARTER AND Job_Profile_Status__c NOT IN
('Created','Removed') AND Branch_ID__c IN('101','102','909','903','941','994','217','904') AND (Action_Stage__c IN
('Start','Construction') OR GC_Awarded__c = TRUE) and (Name like 'P@#$&(%' or Dodge_Report_Number__c like 'P@#$&(%' or
Project_Name__c like 'P@#$&(%' or Action_Stage__c like 'P@#$&(%' or Type_Of_Work__c like 'P@#$&(%' or Removed_By__r.Name like 'P@#
$&(%' or Reason_Why_Project_Removed__c like 'P@#$&(%' or Branch_ID__c like 'P@#$&(%') order by Name asc NULLS FIRST

 

 

this does not search a records with name "P@#$&(intos)". It is giving eror like "Invalid character found in the filter value "P@#$&(%" used with the "like" operator".

 

 

 

I Tried with "like 'P@#$&\\(%'" . here no error but the record is not displayed.

then I tried with "like 'P@#$&\(%'". here I got error like "Invalid character found in the filter value "P@#$&(%" used with the "like" operator".

 

Please help me to silve the issue.

ForcepowerForcepower
Amar, What's the intent of these chars @#$&( within 'P@#$&(%'? One of those characters seems to be a special character that cannot be used in SOQL. Can you do something like this:
like 'P@#$&%into%'
Ram
amarnijeramarnijer

Thank you for your reply. But it is not returning the record.

ForcepowerForcepower
How about "P%" or "P%into%".?
amarnijeramarnijer

Thank you. This will give result. but suppose the data is "Status ( Hot )". Now if the user search for "Status ( H%", then it will not return any record. That is the problem. If user type upto "(" then it is not returning any record.

ForcepowerForcepower
You may just want to filter out the parentheses as they are meta characters for SOQL.