APIs & Integrations

Mark_T
Participant

Adding a value to a deal property

Hi,

 

We have a dropdown select property within Deals that has 310 values.

 

I've read the documentation for doing an update on a property, but it seems to suggest that you have to pass all the values that currently exist, plus the one you're going to add to the endpoint. Have I got this wrong? If so, can someone give an example of how to add one value?

 

This is using:

 

PATCH/crm/v3/properties/{objectType}/{propertyName}"
 
Thanks,
 
M.
0 Upvotes
5 Replies 5
SteveHTM
Top Contributor | Partner
Top Contributor | Partner

Adding a value to a deal property

Worth submitting as an idea if you feel strongly about this alternate option.

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature
0 Upvotes
SteveHTM
Top Contributor | Partner
Top Contributor | Partner

Adding a value to a deal property

@Mark_T  - yes, I have a similar challenge on a dropdown selector with a crazy 530 options (and growing).

To maintain the value automatically, I have to grab the existing list using a Contact property GET query:

"https://api.hubapi.com/crm/v3/properties/" + contact_type + "/" + property_name

 

Then I check that the new option(s) being added don't duplicate anything that already is on that list - if not the new option is appended.

 

The last step is an update to the options as a PATCH as you describe:

"https://api.hubapi.com/crm/v3/properties/" + contact_type + "/" + property_name

(I actually have to keep Contact/Company/Deal properties in step with further patch calls)

 

If I was cleverer, then I'd also find a way to subtract obsolete values from the list so that it doesn't grow without bounds!

 

Hope this is helpful,

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature
0 Upvotes
Mark_T
Participant

Adding a value to a deal property

Hi, thanks for coming back to me.

 

Yes, I'd already thought about doing things that way, using GET on the same property endpoint to get all the current values and then adding what you want as part of a PATCH.

 

I was just concerned that if there was an error part-way through the patch operation that I could potentially lose all the current values. Has the this solution been reliable for you? Have you ever had any issues with it?

 

Thanks,

 

M>

0 Upvotes
SteveHTM
Top Contributor | Partner
Top Contributor | Partner

Adding a value to a deal property

A fair concern, but the PATCH operation seems to be atomic in nature - it appears not to clear any of the existing values, just incrementally add the new options.

 

Happy coding!

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature
0 Upvotes
Mark_T
Participant

Adding a value to a deal property

Really?

 

I have a list with 310 items. If I add number 311 using patch and that's all that in the list I submit, it removes all the previous values.

 

I wish that wasn't the case, it seems really inefficient to have to submit all 311 back in the PATCH action.

 

Regards.

 

M.

0 Upvotes