Custom Object Unique Identifier

Hi,

I created a custom object called shop, with a mandatory property called shop_name

The issue i have is that i can create as many shops i want with the same shop_name.

is there a way to do like in contact object, where you can’t create a second contact with the same email address?

Many thanks

David

Hey @dmattauch,

This is not currently possible, as the only deduplication on any object outside of Contacts is their “ID”.

@Bryantworks How does one set the key? I am struggling with this as well. Setting up a “users” custom object. Was trying to use email as the sole required property and the primary display property, but it seems to let me put in new instances with a change in the case in an email address. I verified contatacts don’t allow that, so how does one set a primary key that increments, if email address doesnt work?

David,

Did you set shop_name to require a unique value when you created it? That would stop you from being able to create multiple records where shop_name is the same.

If you’re still using the API to create, hasUniqueValue would need to be set to true:

# DEPRECATION WARNING: HubSpot API (HAPI) keys are being deprecated, and will be removed from use on 30 November 2022.
curl --request POST \
--url ‘https://api.hubapi.com/crm/v3/schemas?hapikey=[API KEY HERE]’ \
--header ‘content-type: application/json’ \
--data ‘{
“labels”: {
“singular”: “Sample Object”,
“plural”: “Sample Objects”
},
“requiredProperties”: [
“required_object_property”
],
“properties”: [
{
“name”: “required_object_property”,
“label”: “Required object property”,
“isPrimaryDisplayLabel”: true,
“hasUniqueValue”: true
}
],
“associatedObjects”: [
“CONTACT”
],
“name”: “my_object”,
“primaryDisplayProperty”: “my_object_property”,
“metaType”: “PORTAL_SPECIFIC”
}’

Thank you for sharing, @DigitalImpact!