Post

1 follower Follow
0
Avatar

Proper syntax for Where condition in entityQuery

I am trying to get all milestones (with some fields) for a project through the api.

 

I am trying to use the where condition in entityQuery but so far have not got it right:

{'typeName': 'Milestone',
'fields': ['Name', 'StartDate', 'DueDate', 'Work', 'ActualEffort', 'ParentProject'],
'where': {'and': [{
'leftExpression': {'fieldName': 'ParentProject'},
'operator': 'Equal',
'rightExpression': {"id": '/Project/36pn82tc0qjx507kncuo7jfa11109'}
}]}
}

 

Here is the api page for the EntityQuery I am using:

https://api.clarizen.com/V2.0/services/data/EntityQuery

And within that page is the Where condition syntax I am trying to build:

https://api.clarizen.com/V2.0/services/types/Condition

 

 

Here is the error I am getting, I have tried different forms of the syntax but none seem to work:

{'errorCode': 'InvalidOperation',
 'message': "Invalid operation: Operation 'Equal' is incompatible with field 'ParentProject' of 'ObjectIdentifier' data type and  field 'ExternalID' of 'String' data type",
 'referenceId': '12PyK5OLDLiLT3950nfCee'}
Jared Thompson Answered

Please sign in to leave a comment.

1 comment

0
Avatar

For the above - here is what the structure looks like when you query it without the where:

 

{'entities': [{'id': '/Milestone/36pn82tc0qjx507kncuo7jfa11130',
   'Name': 'Executing and Monitoring & Controlling',
   'StartDate': '2019-01-31T13:00:00.0000000',
   'DueDate': '2019-01-31T21:00:00.0000000',
   'Work': {'unit': 'Hours', 'value': 8.0},
   'ActualEffort': {'unit': 'Hours', 'value': 8.0},
   'ParentProject': {'id': '/Project/36pn82tc0qjx507kncuo7jfa11109'}}

so I am trying to add the where so I can filter it by the parentproject id




Note, I also tried this sytax and did not get a result:
{'typeName': 'Milestone',
'fields': ['Name', 'StartDate', 'DueDate', 'Work', 'ActualEffort', 'ParentProject'],
'where': {'and': [{
'leftExpression': {'fieldName': 'ParentProject'},
'operator': 'Equal',
'rightExpression': {"value": '{id: /Project/36pn82tc0qjx507kncuo7jfa11109}'}
}]}
}

Jared Thompson 0 votes
Comment actions Permalink