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");
query.ColumnSet.AddColumns("accountid");
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));
filterAccount.AddFilter(filterName);
filterAccount.AddFilter(filterName2);
query.Criteria = filterAccount;
In the Above Example Am using Both And/OR Condition in FilterExpression with QueryExpression.
That's it 🙂