Header Ads

Header ADS

Make Filter Criteria on TextArea in SOQL And SOSL

We can't use Text Area fields for SOQL and SOSL filter criteria. Text area fields, which can store large amounts of text or even rich text content, may not be directly supported in the same way as other data types like strings or numbers for filtering purposes.






Text area fields are typically used for storing longer textual content, and their content might not be well-suited for direct filtering in a query context


As a result, we can not use text area fields in SOQL and SOSL filters.

 

SELECT Id, Name FROM Account WHERE Description LIKE '%keyword%' will not work and you can not use this field in the where clause.

 

Different Approach:


List<Account> result = new List<Account>();

for(Account acc : [select id, name, Description from Account) {

    if(acc. Description.contains('test description')) {

        result.add(acc);

    }

}

#Salesforce #SalesforceDeveloper

Reference Link: https://developer.salesforce.com/forums/?id=906F00000008zxSIAQ#:~:text=You%20can%20not%20use%20text,to%20check%20your%20filter%20criteria. 

No comments

Powered by Blogger.