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

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…)

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

@AliFawadHassan Thanks for the reply.
I’m using PHP package for create property.(GitHub - HubSpot/hubspot-api-php: HubSpot API PHP Client Libraries for V3 version of the API · GitHub)

$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);

Hi @KPadhiyar :waving_hand:

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.

This is the error that I got from HubSpot package.


@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…)


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]

],

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