The right side value needs to be an EntityId object and not a constant string
cond1.RightExpression = new ConstantExpression() { Value = new EntityId() { TypeName = "TrackStatus", Value = "Off Track" } }
EntityQuery query = new EntityQuery();
query.TypeName = "Workitem";
OrderBy orderByName = new OrderBy();
orderByName.FieldName = "Name";
Compare cond1 = new Compare();
cond1.LeftExpression = new FieldExpression() { FieldName = "TrackStatus" };
cond1.Operator = Operator.Equal;
cond1.RightExpression = new ConstantExpression()
{
Value = "Off Track"
};
Compare cond2 = new Compare();
cond2.LeftExpression = new FieldExpression() { FieldName = "TrackStatus" };
cond2.Operator = Operator.Equal;
cond2.RightExpression = new ConstantExpression()
{
Value = "At Risk"
};
query.Where = new Or() { Conditions = new Condition[] { cond1, cond2 } };
Please sign in to leave a comment.
The right side value needs to be an EntityId object and not a constant string
cond1.RightExpression = new ConstantExpression() { Value = new EntityId() { TypeName = "TrackStatus", Value = "Off Track" } }