Programmatically creating a currency-formatted custom property

Hi folks,

I am currently in the process of migrating my current client from another CRM product to HubSpot. This implies migrating some source data into custom properties, which I would like to be able to create programmatically for a fully automatic and repeatable process.

I have been able to develop a working solution using the Company Properties API, but one detail remains: is it possible to programmatically set a property to be displayed as currency, just like when one checks the relevant checkbox in the UI?

Thanks in advance!

Hi, @metamatik.

This is certainly possible!

I just created a new custom contact property with the Currency box checked with the following payload:

{
 "name": "test_currency_property",
 "label": "Test Currency Property",
 "description": "A test currency property created via the Contact Properties API.",
 "groupName": "contactinformation",
 "type": "number",
 "fieldType": "number",
 "formField": true,
 "displayOrder": 6,
 "displayMode":"current_value",
 "showCurrencySymbol":true
}

Note the parameters "displayMode":"current_value" and "showCurrencySymbol":true.

Thank you very much Isaac!

As I was unable to find guidance in the documentation, I had fiddled around a bit and tried to add

showCurrencySymbol

to the payload, but it hadn’t worked. Also adding

displayMode

was the trick :slightly_smiling_face:

As an aside, is my assessment correct that these parameters are not documented at the moment? Not looking to blame anyone here, but if they are I’d be interested in the relevant URL since I might need to use more in the near future ^^

(also, meta-annoyance: the rich text editor here is preventing me from using

<code>

tags in my reply to you :p)

Apologies for the delayed response, @metamatik.

Glad I could help!

You are absolutely correct that this isn’t currently documented; thanks for bringing this to our attention. I’ve shared feedback with the team which manages the docs.

I actually found the solution by creating a currency property in the UI and then retreiving its meta data with the Get a contact property endpoint. I then created a new currency property with this endpoint
16x16_smiley-very-happy.png.png
.

Hi, I have created a custom contact property but I can not understand where I need to put it and how can I call them or what process I need to do to add created JSON property on Hubspot contact property. Thanks

Hi, @abdurrakib136.

Are you also trying to create a custom contact property which reflects currency?

It sounds like you’ve already created a custom contact property, perhaps in the UI, but are having trouble updating it via the Contact Properties API. Is that accurate?
If so, could you share a few details of what you have done so far and where you are getting stuck? Please share your Hub ID and the custom property’s internal name to start.