rest-api icon indicating copy to clipboard operation
rest-api copied to clipboard

Dynamic filter doesn't work on number

Open kikora opened this issue 7 years ago • 2 comments

If a custom field has type=Number it seems it's not possible to search for it with a dynamic filter.

Testcase:

  1. Create a new custom field for a company, named "testingdf" and set type=Number
  2. Go to a company and set testingdf=12345
  3. Do a dynamic-filter REST call with filterJson={"rules":[{"LHS":"testingdf","CONDITION":"EQUALS","RHS":"12345"}],"contact_type":"COMPANY"}'
  4. An empty array [] will be returned, with status code 200 (according to the document 204 should have been returned for a no match).
  5. Update the custom filed and set type=TextField
  6. Do the same dynamic-filter call, still just an empty array as response
  7. Update the company and set testingdf to something else, then change it back to 12345 (if the field isn't updated to something else first it won't work).
  8. Now do that dynamic-filter call again and the company will be returned.
  9. If you switch back to type=Number and update the field for the selected company it'll stop working again.

Calling with filterJson={"rules":[{"LHS":"testingdf","CONDITION":"EQUALS","RHS":12345}],"contact_type":"COMPANY"}' , aka with a number as RHS does not change anything.

Full dynamic-filter call: curl https://something.agilecrm.com/dev/api/filters/filter/dynamic-filter -H "Accept: application/json" \ -H "Content-Type :application/x-www-form-urlencoded" \ -d 'page_size=25&global_sort_key=-created_time&filterJson={"rules":[{"LHS":"testingdf","CONDITION":"EQUALS","RHS":"12345"}],"contact_type":"COMPANY"}' \ -v -u user@something:key -X POST

kikora avatar Oct 03 '17 13:10 kikora

I just bumped into this same problem. How has this not been addresses almost 4 years later?!

shawndewet avatar May 13 '20 10:05 shawndewet

I want to get some contact data filtered by a custom field.

While trying to call the API via CURL (eg. as described in the documentation https://github.com/agilecrm/rest-api#devapifiltersfilterdynamic-filter-1) the command returns the following error message:

The command "filterJson" is either misspelled or could not be found.

jensthiemann avatar Nov 16 '20 10:11 jensthiemann