You need to sign in to do that
Don't have an account?

LIKE comparison operator not working as expected
Hi all,
I have a weird problem where I am querying from my Sandbox evnironment the following using the LIKE operation using the following snippet of code:
string s = '%__c'; list<CaseHistory> hist = new list<CaseHistory>(); hist = [Select Field From CaseHistory Where Field like :s Order by Field Limit 10];
I get a erro as follows:
Compile error at line 3 column 5
invalid operator on id field
I have no idean where I am going wrong but I seem to be following the query syntax correctly?
Is there a bug in Sandbox query with the LIKE operator?
Thanks for your help!
Hi,
The LIKE operator is supported for string fields only. Field on CaseHistory is a Picklist and returns Id of ownerAssignment, ownerAccepted or ownerEscalated i.e OwnerId.
Go through following Idea.
https://success.salesforce.com/ideaView?id=08730000000HYwY
/**If this post helps you then please mark it as a solution and don't forget to give me kudo's.***/
Thanks
www.grazitti.com
All Answers
Hi,
The LIKE operator is supported for string fields only. Field on CaseHistory is a Picklist and returns Id of ownerAssignment, ownerAccepted or ownerEscalated i.e OwnerId.
Go through following Idea.
https://success.salesforce.com/ideaView?id=08730000000HYwY
/**If this post helps you then please mark it as a solution and don't forget to give me kudo's.***/
Thanks
www.grazitti.com
select StageName from opportunity where StageName LIKE '%Customer%'
Tried querying the CaseHistory object for changes in the Case on custom
fields that end with '__c'.
Here is the code:
string s = '%__c%';
list l = new list();
l = [Select Field From CaseHistory Where Field like :s];
Thanks.