Unable to delete CO property

I changed the primaryDisplayProperty of a custom obect from oldName to newName and I can confirm newName is now the primary prop but I cannot delete oldName as it is in use by the create CO form and it will not let me remove the field saying “The property is part of the object architecture and can’t be removed”. Do I just wait longer? (been about 6 hours so far).

Hello! @cyberwombat

I am curious about how you were able to change the primaryDisplayProperty of a custom object.

In my case, I cannot change it after the custom object was created, but I can edit its property label. Though editing the label does not create a new property, so I wonder how your “oldName” property was created.

Did you try detaching the property from the forms that were using it? You can see the “used in” tab inside edit property to see all the places where it is being used.

Was I able to help answer your question? Help the community by marking it as a solution.

You can change it using the API endpoint `crm.schemas.coreApi.update(objectType, { primaryDisplayProperty: “foo”)`. But while I was able to change it the create item form remains unchanged and I cannot remove that form field which prevents me from deleting the property. Sounds like a bug to me. We will probably have to delete this object and all the work we have done around it unfortunately.

I see, so as developers we can still change the primaryDisplayProperty even after the object was created. Interesting!

So, I was able to recreate the problem. My intuition tells me that we should look for a way to remove it from the form schema using API.

@cyberwombat

I found the solution to archive the seemingly locked old primaryDisplayProperty.

1) Use the schemas API to change the custom object’s requiredProperties.

PATCH https://api.hubapi.com/crm-object-schemas/v3/schemas/<your object>

{
 "requiredProperties": [
 "otherRequireProperty"
 ],
"primaryDisplayProperty": "newPrimaryProperty"
}

2) Open the create object form and remove the old primaryDisplayProperty.

3) Edit the old property and archive it!

Reference: Schemas API guide - HubSpot docs

Was I able to help answer your question? Help the community by marking it as a solution.

Great! I had tried deleting it and evidently the required flag must be removed from schema prior to deleting with API. Deleting through API gave me warning abpout being in use but removing it from requiredProperties allowed me to do it without a complaint and it automatically replaced the field in the item create form. (I did everything through the API and then checked). Thank you!