Power Community

Power Community

Create Filter Expression with AND & OR Condition in Model Driven Apps


Implementation Steps:

Consider a Scenario that I want to make Multiple Filter Condition with Both And/or Condition From Account Table Using Plugins

QueryExpression query = new QueryExpression("account");
FilterExpression filterAccount = new FilterExpression(LogicalOperator.Or);
FilterExpression filterName = new FilterExpression(LogicalOperator.And);
filterName.Conditions.Add(new ConditionExpression("NAME_LOGICALNAME", ConditionOperator.Equal, PASSYOURVALUEHERE));
filterName.Conditions.Add(new ConditionExpression("NAME_LOGICALNAME", ConditionOperator.Equal, PASSYOURVALUEHERE));
FilterExpression filterName2 = new FilterExpression(LogicalOperator.And);
filterName2.Conditions.Add(new ConditionExpression("NEWFIELD_LogicalName", ConditionOperator.Equal, id2));
filterName2.Conditions.Add(new ConditionExpression("NEWFIELD_LogicalName", ConditionOperator.Equal, id3));
query.Criteria = filterAccount;

In the Above Example Am using Both And/OR Condition in FilterExpression with QueryExpression.

That’s it 🙂

This post was originally published on this site

- Advertisement -spot_img


Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

Locking down SharePoint so only Integrated App can be used

This is an issue that has been the subject of many questions and below is the series of processes...

More Articles Like This

- Advertisement -spot_img