Wednesday, June 12, 2013

Case in-sensitive search in MSCRM 2011

To do a case insensitive search in MSCRM 2011 we need to tweak the query a little bit ,for e.g.

if (!String.IsNullOrEmpty(fieldname)) query.Criteria.AddCondition("fieldname".ToLower(), ConditionOperator.Equal, fieldname.ToLower());
EntityCollection col = service.RetrieveMultiple(query);
Here I am setting the schema name to ToLower() which actually does the trick, hope this help.Leave your comments.

4 comments:

Anonymous said...

"fieldname".ToLower() simple returns "fieldname". So all that does is tell CRM that the CRM field you want to compare is "fieldname"... It does not tell it to take whatever value that field has and make it ToLower(). So this does not accomplish the task at all. Please take this down/stop posting it.

Saurabh Sinha said...

It used to work with previous version , I haven't verified it in crm 2015.

Saurabh Sinha said...
This comment has been removed by the author.
Calm Like a Bomb said...

No, Saurabh Sinha, this never worked in a previous version.