APIs & Integrations

KPadhiyar
Participant

I got error while creating ENUM type property for contact object.

SOLVE

Can anyone tell me if HubSpot has made any changes related to creating properties of type ENUM? From yesterday, I’ve been getting an error while creating a property in HubSpot for the contact object.

I’m creating the property with empty options, and the error I got:
{"status":"error","message":"Property 'test_property' of object type ' 0- 1' has no options but options are re (truncated...)

KPadhiyar_0-1737710625056.png

 

 

1 Accepted solution
zach_threadint
Solution
Guide

I got error while creating ENUM type property for contact object.

SOLVE

Hi @KPadhiyar 👋

 

For most integration use cases, I generally recommend avoiding HubSpot's API Client Libraries in favour of interacting with HubSpot APIs via a dedicated HTTP request package. Regardless, based on your example request, I'd recommend [1] making sure the Contact property group name "test" exists in the given HubSpot Portal and [2] defining at least 1 option when creating properties of "enumeration" type.

 

I hope that proves helpful. Please let me know if you have any follow-up questions.

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


View solution in original post

0 Upvotes
6 Replies 6
EJames4
Member

I got error while creating ENUM type property for contact object.

SOLVE

It looks like the issue is that, HubSpot requires at least one option for ENUM-type properties. Try modifying your request like this:
"name" => "test"
"label" => "Test",
"description" => "Test",
"group_name" => "test",
"type" => "enumeration",
"field_type" => "checkbox",
"form_field" => true,
"options" => [
[
"label" => "Option 1",
"value" => "option_1",
"displayOrder" => 0
]
]
]);
Adding at least one option should help resolve the error 

0 Upvotes
KJames77
Member

I got error while creating ENUM type property for contact object.

SOLVE

@KPadhiyar wrote:

Can anyone tell me if HubSpot has made any changes related to creating properties of type ENUM? From yesterday, I’ve been getting an error while creating a property in HubSpot for the contact object.

I’m creating the property with empty options, and the error I got:
{"status":"error","message":"Property 'test_property' of object type ' 0- 1' has no options but options are re (truncated...)

KPadhiyar_0-1737710625056.png

 

 


It looks like the issue is due to the options array being empty. HubSpot requires at least one option for ENUM-type properties. Try adding options like this:

"options" => [

    ["label" => "Option 1", "value" => "option_1", "displayOrder" => 0]

],

0 Upvotes
AliFawadHassan
Participant

I got error while creating ENUM type property for contact object.

SOLVE

Could you please share the complete cURL request?
Additionally, please ensure that there are no spaces in the object type, such as '0-1'.

0 Upvotes
KPadhiyar
Participant

I got error while creating ENUM type property for contact object.

SOLVE

This is the error that I got from HubSpot package.
KPadhiyar_0-1737713294620.png

 

0 Upvotes
KPadhiyar
Participant

I got error while creating ENUM type property for contact object.

SOLVE

@AliFawadHassan Thanks for the reply.

I'm using PHP package for create property.(https://github.com/HubSpot/hubspot-api-php)

$request = new HubSpot\Client\Crm\Properties\Model\PropertyCreate\PropertyCreate([
"name" => "test"
  "label" => "Test"
  "description" => "Test"
  "group_name" => "test"
  "type" => "enumeration"
  "field_type" => "checkbox"
  "form_field" => true
  "options" => [],
]);

$service = $hubspot->crm()->properties()->coreApi()->create('contact', $request);

 

0 Upvotes
zach_threadint
Solution
Guide

I got error while creating ENUM type property for contact object.

SOLVE

Hi @KPadhiyar 👋

 

For most integration use cases, I generally recommend avoiding HubSpot's API Client Libraries in favour of interacting with HubSpot APIs via a dedicated HTTP request package. Regardless, based on your example request, I'd recommend [1] making sure the Contact property group name "test" exists in the given HubSpot Portal and [2] defining at least 1 option when creating properties of "enumeration" type.

 

I hope that proves helpful. Please let me know if you have any follow-up questions.

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


0 Upvotes