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

ChatGPT – Insights

Hi Folks, In this modern era where AI/ML is ruling the world and automating all the possible day to day...

More Articles Like This

- Advertisement -spot_img