APIs & Integrations

ReCharge-DE
Member

How to create a property with fieldtype = Hubspot User via the API?

Hi, 

 

I am currently working to clone our production Hubspot instance into our development instance for testing. We are currently trying to clone company properties. I am running into trouble when trying to create a property that one of our users set up with field type = HubSpot User.

 

According to documentation, a HubSpot User fieldtype is: 

HubSpot user: stores a list of HubSpot users in your account. Only one HubSpot user can be selected as a value. This allows you to have a custom owner property, separate from the default [Object] owner property. You can create up to 30 custom HubSpot user properties.

 

When I view this property in the UI (in our prod instances), I see pages of options. When I pull this type of property from the API, there are no options listed. Perhaps this is because of the large amount of options. How am I supposed to create this property via the API? Do I need to manually pull a list of current users to set up as options on the property? Will that dynamically update as more users are added?

 

I cant seem to find any API documentation about creating a property with HubSpot User fieldtype. 

 

When I pull this property via API, I get: 

 

"name":"support_owner",
"label":"Support Owner",
"type":"enumeration",
"fieldType":"OWNER",
"description":"",
"groupName":"account_management",
"options":[
],
"createdUserId": ....

 

 

What I have been attempting to post to API: 

 

{
"name":"support_owner",
"label":"Support Owner",
"type":"enumeration",
"fieldType":"OWNER",
"groupName":"account_management",
"externalOptions":true,
"options":[
]
}

 

I have tried including other fields (externalOptions, referencedObjectType), but continue to get the same error. 

 

Note: I am creating multiple properties in one batch via https://api.hubapi.com/crm/v3/properties/companies/batch/create enpoint

4 Replies 4
ajinvise
Participant

How to create a property with fieldtype = Hubspot User via the API?

Hi!
I have just tried the solution form @vbrech above but it did not work as of January 2023.

 

const input ={
    name: "our_reference",
    label: "Our Reference",
    description: "Our Reference, i.e. the HubSpot Owner",
    groupName: "my_group",
    referencedObjectType: "OWNER",
    type: "enumeration",
    fieldType: "select",
    externalOptions: true,
    options: [],
    formField: false,
    hasUniqueValue: false,
} // "Property 'our_reference' of object type '0-3' has no options but options are required!"

 

Tried a few variations, among them removing the options key.

Maybe @PamCotton know someone who can provide a canonical answer for this issue?
Thank you 🙂

EDIT: I see now I already bumped this Aug 12, 2022, then we solved it by creating it manually in the portal. But when doing it in a integration/app context its critical we can get it to work via the API

0 Upvotes
ajinvise
Participant

How to create a property with fieldtype = Hubspot User via the API?

It seems @vbrech s solution, does no longer work. It gives me:

message: "Property 'my_property' has no options but options are required!",

Ping @dennisedson , any advice?

0 Upvotes
vbrech
HubSpot Employee
HubSpot Employee

How to create a property with fieldtype = Hubspot User via the API?

posting here just in case somebody finds this thread in future. This request seems to work:

vbrech_0-1630490740899.png

 

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

How to create a property with fieldtype = Hubspot User via the API?

Hey @ReCharge-DE 

Welcome to the Community!

@MatthewShepherd , @piersg do you have any insights?

Regarding transfering to a dev environment, I am thinking that even if you could write to the options, they would not match what the system would generate for the ids, anyway.

 

0 Upvotes