Where clause for Long Text Area field in SOQL:
Error - System.QueryException: field 'longTextArea__c' can not be filtered in query call
Soultion - We can not use text area fields in SOQL and SOSL filter criterias.
Workaround -
List<objectName__c> oList = new List<objectName__c>();
for(objectName__c oName : [SELECT Name, Status__c, longTextArea__c FROM objectName__c WHERE Name LIKE '%' + String.escapeSingleQuotes(name) +'%' + OR Status__c = String.escapeSingleQuotes(status)]) {
if(oName.longTextArea__c.contains('filter string')) {
oList.add(oName);
}
}
Comments
Post a Comment