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
OdedHarnivOdedHarniv 

Workaround for QueryException: field can not be filtered in query call

Hello

 

I have a relatively large SOQL query (I'm filtering according to about 10 different fields) and three of the fields I'm filtering are Long Text Areas.

I'm getting the following error (this is for one of the fields):

 

querySystem.QueryException: field 'Abstract__c' can not be filtered in query call

 

I assume that Long Text Areas cannot be filtered and I wonder if anyone has a workaround for this limitation?

 

Thanks 

 

 

Oded

 
dkadordkador

The only "workaround" is to not filter on them at all.

OdedHarnivOdedHarniv

Unfortunately for me my application logic needs to find some text inside these fields and show the user the records if the text is there...

Ankit AroraAnkit Arora

You can not use long text area fields in where clause of query. So to overcome this what I have done in my specific case is used SOSL to find a particular value in text area.

 

When I get records from SOSL then I merge the those records to SOQL. Not sure if it suits your req.

 

*Note : SOSL will only return you 200 records at a time.

 

Thank

Ankit Arora

Blog | Facebook | Blog Page

dkadordkador

Ankit's suggestion is a good one if it will suit your needs.  Please understand some of the limitations of SOSL by reading this guide:

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_sosl_find.htm#i1423049

OdedHarnivOdedHarniv

Thank you Ankit 

 

I have thought of the same but I don't want to lose the sort functionality of the SOQL

Ankit AroraAnkit Arora

If you want to sort on textarea fields then, am sorry we can not do this.

 

But if you get record ids from SOSL and use them in SOQL then you can sort on other fields except textarea.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

OdedHarnivOdedHarniv

Nice, creative thinking :-)

 

This is what I'll try doing.

 

Thanks

 

 

Ankit AroraAnkit Arora

Let us know what you did, that will be interesting :)

Meanwhile if you the approach clear then can you please mark it as solution?

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

OdedHarnivOdedHarniv

Do you know if there is anyway I can run SOSL in batch to retrieve more than 200 records?

Ankit AroraAnkit Arora

I don't think so.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

Ankit AroraAnkit Arora

If you got the desired answer then please mark it as solution, so others may get benefit.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page