You need to sign in to do that
Don't have an account?
Simrin
Where clause for picklist
public List<CustomClass> list = [Select AColumn__c, BColumn__c From CustomClass WHERE UserId = :UserInfo.getUserId() and BColumn__c =:'TEST'];
Also tried
BColumn__c like 'TEST%'
BColumn__c is a Picklist which can have value TEST, TEST01, TEST03,etc
I am not able to make a correct string comparision
The colon is for variable binding, for example BColumn__c = :someStringVariable
If you need to make the query work with multi select picklists you can also use the INCLUDES function (See here for more info: http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_soql_querying_multiselect_picklists.htm)
All Answers
The colon is for variable binding, for example BColumn__c = :someStringVariable
If you need to make the query work with multi select picklists you can also use the INCLUDES function (See here for more info: http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_soql_querying_multiselect_picklists.htm)
Just do a small change in your SOQL and you will get the result as you expected.
Modified SOQL: I hope the above solution is useful for you.
Please Mark this as Best Answer if it helps you
Regards,
Grazitti Team
Web: www.grazitti.com
Email: sfdc@grazitti.com
; (semi colon) Specifies AND for two or more strings. Use ; for multi-select picklists when two or more items must be selected.
, (comma) specifies AND