Hello,
I am trying to write a REST entity query that will return all of the Timesheet entries by a specific user where the project type is equal to a certain value, and the project name is NOT equal to several different project names. I am able to run a query that returns this for when the project name IS equal to one of the specified project names, bit I get a 500 error whenever I change this from "In" to "Not In".
Any idea why this might be happening, and could you please provide some guidance on doing this with the REST API?
It's a relatively long query, but here is what I have:
{
"TypeName": "Timesheet",
"Fields": ["Duration.value","CreatedBy.Name", "WorkItem.Name", "WorkItem.ProjectType.Name","ReportedDate"],
"Orders": [{"order":"Ascending","fieldName":"CreatedBy"}],
"Where": {
"_type": "And",
"conditions":[
{
"LeftExpression": {
"FieldName": "WorkItem"
},
"Operator": "In",
"RightExpression": {
"_type": "QueryExpression",
"Query": {
"TypeName": "WorkItem",
"_type": "EntityQuery",
"Where": {
"LeftExpression": {
"FieldName": "Project"
},
"Operator": "In",
"RightExpression": {
"_type": "QueryExpression",
"Query": {
"TypeName": "Project",
"_type": "EntityQuery",
"Where": {
"LeftExpression": {
"FieldName": "ProjectType"
},
"Operator": "Equal",
"RightExpression": {
"Value": "/ProjectType/Internal"
}
}
}
}
}
}
}
},
{
"LeftExpression": {
"FieldName": "CreatedBy"
},
"Operator": "In",
"RightExpression": {
"_type": "QueryExpression",
"Query": {
"TypeName": "User",
"_type": "EntityQuery",
"Where": {
"LeftExpression": {
"FieldName": "DisplayName"
},
"Operator": "Equal",
"RightExpression": {
"Value": "Alex Ayala"
}
}
}
}
},
{
"LeftExpression": {
"FieldName": "WorkItem"
},
"Operator": "Not In",
"RightExpression": {
"_type": "QueryExpression",
"Query": {
"TypeName": "Project",
"_type": "EntityQuery",
"Where": {
"_type": "Or",
"conditions": [
{
"LeftExpression": {
"FieldName": "Name"
},
"Operator": "Equal",
"RightExpression": {
"Value": "Admin"
}
},
{
"LeftExpression": {
"FieldName": "Name"
},
"Operator": "Equal",
"RightExpression": {
"Value": "PTO"
}
},
{
"LeftExpression": {
"FieldName": "Name"
},
"Operator": "Equal",
"RightExpression": {
"Value": "Holiday"
}
}
]
}
}
}
}]
}
}