pipedrive / client-nodejs

Pipedrive API client for NodeJS
MIT License
205 stars 82 forks source link

Un-setting custom fields #185

Closed manetrejo closed 2 years ago

manetrejo commented 3 years ago

Hi all, I want to un-set a custom value from a deal:

pipedrive.DealsController.updateADeal({ dealId, { '06315c81438153872d8707d5bff50d8bfde683f2': null } } });

I'm getting this error: { "errorMessage": "HTTP Response Not OK", "errorCode": 400, "errorResponse": "{\"success\":false,\"error\":\"Bad request\",\"error_info\":\"Please check developers.pipedrive.com for more information about Pipedrive API.\",\"data\":null,\"additional_data\":null}" }.

I also tried with undefined and it didn't work. Is not an option to use an empty value ("" or 0) because emptiness is not nothing. In the 9.x version work as I'm expecting.

Thanks

Rodz13 commented 3 years ago

Hi there! Thanks for you request. We will look into it as soon as possible.

dmitriyeff commented 3 years ago

Hi @manetrejo ,

To update a custom field itself, you can use this endpoint: https://developers.pipedrive.com/docs/api/v1/#!/DealFields/updateDealField

It looks like the updateADeal endpoint works as expected, value parameter expects a string, and null could not be passed. If omitted, the value will be set to 0. For more information, you can check readme: https://github.com/pipedrive/client-nodejs#-updateadeal

manetrejo commented 3 years ago

Hi @dmitriyeff, thanks for your replay.

To update a custom field itself, you can use this endpoint: https://developers.pipedrive.com/docs/api/v1/#!/DealFields/updateDealField

How can I use this endpoint through the nodejs client? I moved from the 9.2 version to the 10.4 and I struggled trying to reproduce the same behavior for some actions, this is only one example.

It looks like the updateADeal endpoint works as expected, value parameter expects a string, and null could not be passed. If omitted, the value will be set to 0. For more information, you can check readme: https://github.com/pipedrive/client-nodejs#-updateadeal

Sorry, maybe I confused you. The problem is in the custom deal fields. I have no problem setting the "value" field for an deal.

Thanks!

dmitriyeff commented 3 years ago

@manetrejo hey, check example of updating custom fields values here: https://github.com/pipedrive/client-nodejs#-updateadealfield

I hope this will help.