web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to use multiple 'Like' operator in Query Expression ?

(0) ShareShare
ReportReport
Posted on by

Hi Guys,

Requirement is to filter system views based on security role. In which i am using below query expression to filter the system views. I was able to use only one like operator.

Code:

ConditionExpression queryCondition = new ConditionExpression("name", ConditionOperator.Like, "My %");
qe.Criteria.Conditions.Add(queryCondition);

Where i need system view that starts with "My" and "Team"... please help me to do it.

Thanks,

Vignesh Mohan

*This post is locked for comments

I have the same question (0)
  • EmployeeOcta Profile Picture
    6 on at
    RE: How to use multiple 'Like' operator in Query Expression ?

    Go through below link.

    msdn.microsoft.com/.../gg309410.aspx

    and modify your needs accordingly.

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,188 Moderator on at
    RE: How to use multiple 'Like' operator in Query Expression ?

    The following should help you out:

               QueryExpression query = new QueryExpression

               {

                   EntityName = entityName,

                   ColumnSet = new ColumnSet(true),

                   Criteria = new FilterExpression(LogicalOperator.Or)

                   {

                       Conditions =

                       {

                           new ConditionExpression("name", ConditionOperator.Like, "My%"),

                           new ConditionExpression("name", ConditionOperator.Like, "Team%")

                       }

                   }

               };

    Basically, set the Criteria Filter Expression with Logical Operator "OR"

    Hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans