Post

2 followers Follow
0
Avatar

Iam getting error Value Off Track is invalid for this field

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 } };

Hari Answered

Please sign in to leave a comment.

1 comment

0
Avatar

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" } }

Uri Tzikoni 0 votes
Comment actions Permalink