Hi!
I get the following error when trying to update a dropdown custom property on contact and customer via the API:
body: {
status: 'error',
message: "Property option labels must be unique. For the property 'X' of object type 'Y' these labels are duplicated: Z",
correlationId: 'dcc084f8-cb3f-4a7b-9704-67e00a1f54b0',
context: [Object],
category: 'VALIDATION_ERROR',
subCategory: 'PropertyValidationError.NON_UNIQUE_OPTION_LABELS'
},
Z has been a part of the dropdown X before, but was removed some time ago. I’m now trying to add it back without any luck. It works for elements that haven’t been in the list before.
The javascript for the custom code:
const hubspot = require('@hubspot/api-client');
const hubspotClient = new hubspot.Client({
accessToken: process.env.access_token,
numberOfApiCallRetries: hubspot.NumberOfRetries.Six,
});
const targetContactDropdownSelect = await hubspotClient.apiRequest({
method: 'GET',
path: `/crm/v3/properties/contacts/${contactPropertyName}`
});
targetContactDropdownSelect.body.options.push({
label: property,
value: objectId,
})
await hubspotClient.apiRequest({
method: 'PATCH',
path: `/crm/v3/properties/contacts/${contactPropertyName}`,
body: {
options: targetContactDropdownSelect.body.options
}
});