AleksandrRogov / DynamicsWebApi

DynamicsWebApi is a Microsoft Dataverse Web API helper library for JavaScript & TypeScript
MIT License
268 stars 58 forks source link

$filter in operator not supported? #121

Closed bmutafov closed 1 year ago

bmutafov commented 1 year ago

I try to query using filter like this: _new_assignment_value in ('<id1>', '<id2>',... ) and I get the following error message:

[Nest] 21600  - 10/14/2022, 12:31:38 PM   ERROR [ExceptionsHandler] The method or operation is not implemented.
Error: The method or operation is not implemented.
    at Object.handleHttpError (C:\Users\Work\assistant\node_modules\dynamics-web-api\lib\helpers\ErrorHelper.js:190:21)
    at IncomingMessage.<anonymous> (C:\Users\assistant\node_modules\dynamics-web-api\lib\requests\http.js:156:32)
    at IncomingMessage.emit (node:events:402:35)
    at IncomingMessage.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Is that something coming from the Dynamics API not supporting the in operator, or the library does not?

AleksandrRogov commented 1 year ago

@bmutafov the error is coming from Dynamics. There is no "in" operator in the filter, but there is a function Microsoft.Dynamics.CRM.In.

I haven't yet implemented the parameter aliases in the query (I have added them but haven't pushed the patch yet), so use it the following way:

?$filter=Microsoft.Dynamics.CRM.In(PropertyName='_new_assignment_value ',PropertyValues=[<id1>,<id2>])

If it does not work you can always replace it with "or" operator like this:

?$filter=_new_assignment_value eq <id1> or _new_assignment_value eq <id2>

Hope this helps.

AleksandrRogov commented 1 year ago

Closing due to inactivity.