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
d3developerd3developer 

Can't query Rich Text

 

Trying to filter on a rich text field yields the following error:

 

 

 

INVALID_FIELD: 
formation__Form_Field__c where formation__Info__c != ''
                               ^
ERROR at Row:1:Column:584
field 'formation__Info__c' can not be filtered in query call

 

 

 

 

aalbertaalbert

As specified in the API docs, you can't have a long area text field (including rich text area) in a SOQL Where clause.

d3developerd3developer

This makes me very sad.

DanCurryJrDanCurryJr

I find that it is not just in the where clause, but querying rich text fields seems to be broken across the board.  I have submitted this to Salesforce support for further evaluation, as this worked as recently as last month.

Joe ZaloomJoe Zaloom

Hi, have you gottan a reply from Salesforce by any chance? I find that I can't refer to a custom rich text field anywhere or I get an  INVALID_FIELD error.

thx

 

INVALID_FIELD
DanCurryJrDanCurryJr

what api version are you using in your script?  I switched to 19 and that fixed the issue.

d3developerd3developer

You can query on rich text w/ api v. 19?

DanCurryJrDanCurryJr

Yes.  You also need to make sure that you're using the most recent verions of Force.com in your ide.

shrishri

can we use the rich text Area in email template?

Imran MohammedImran Mohammed

Yes, we can use Rich text fields in the email template.

 

shrishri

Thanks Imran...

DanCurryJrDanCurryJr

Be careful that you don't try to pull it into a plain-text email though.

samrat.1985@lntinfotechsamrat.1985@lntinfotech

How did u achieve that please explain.?

 

I have this scenario where i want to search in a Rich Text field Say "Search_Rich__c". How do i write the search SOQL string using the api V19.0? that u are talking about

DanCurryJrDanCurryJr

have you tried something like

 

 

sObject[] myObject = [select FieldList from sObject where Search_Rich__c like '%search term here%'];

 

 

samrat.1985@lntinfotechsamrat.1985@lntinfotech

This is my VF page

<apex:page controller="SOQLController" >
  <apex:pageBlock title="Retrived Ids">
      <apex:dataList value="{!queryResult}" var="r">
             <apex:outputText value ="{!r.Id}" /> 
               </apex:dataList></apex:pageBlock>
 </apex:page>

 

And this is the controller

public class SOQLController {

  
  public List<sObject> queryResult { get{return queryResult;}set{ queryResult = value ;}}
       
  
    public PageReference query(){
           
                 
        // create the query string
      
        String qryString = [SELECT Id FROM Bill_Staments__c WHERE Rich__c like '%first bill%'];

        // execute the query
        queryResult = Database.query(qryString) ;
        
       return null;
        }

}

 

And i get the following error

Error: Compile Error: field 'Rich__c' can not be filtered in query call at line 12 column 28

 

HariPHariP

I got the same problem for TextArea field too. "field 'TextArea__c' can not be filtered in query call'.

I used SOSL query to filter this.

amatorVitaeamatorVitae
You can query Long Text Area fields and Rich Text area fields in SOQL, but you can't  filter by them.

See here for more (Salesforce.StackExchange is pretty awesome)!  http://salesforce.stackexchange.com/questions/21298/filtering-by-long-text-area-field-in-soql