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
Kishan TrambadiyaKishan Trambadiya 

field can not be filtered in query call

Here i given the SOQL code for update and that generating the compile error like field 'Chatter_Monitor_Policy_Keyword__c' can not be filtered in query call.

string abc=obj[0].Chatter_Monitor_Policy_Keyword__c;
string s ='%'+ abc + '%';
List<Chatter_Monitor_Policy__c> records = [SELECT Id, Chatter_Monitor_Policy_Keyword__c from Chatter_Monitor_Policy__c where Chatter_Monitor_Policy_Keyword__c Like:s and CreatedById =: UserInfo.getUserId()];
if(records.size()!=null)
        {
            for(Integer i=0;i<records.size();i++)
            {
                     records[0].Chatter_Monitor_Policy_Keyword__c = s;
                     update records[0];
            }
   

vishal@forcevishal@force

What field type is that field?

Kishan TrambadiyaKishan Trambadiya

Its a Text area field.

vishal@forcevishal@force

Thought so!

 

you can't have a long area text field (including rich text area) in a SOQL Where clause

Kishan TrambadiyaKishan Trambadiya

I cant change it to Text fields. what is the other way to solve that??

Arjun1981Arjun1981

Hi,

 

You cannot use TextArea/Long Text  field in SOQL and SOSL.

The alternative way is to fetch all the records from the object and then iterate your records to check the filter criteria.

to check the filter criteria you can use the object.textArea_field__c.contains(''check string') method.

 

Thanks,

 

Please let me know if this way helped you in getting right solution.