APIs & Integrations

barteksonarhome
Contributor

Delete custom type

SOLVE

Hi. I created a custom object and I would like to delete this type.

What I do:
1. I delete all objects from this type, from"archive" too.
2. I use:
DELETE  /crm/v3/schemas/pXYZ_name_of_type
DELETE  /crm/v3/schemas/2-5555555
DELETE  /crm/v3/schemas/pXYZ_name_of_type + { archived: true }
DELETE  /crm/v3/schemas/2-5555555 + { archived: true }
response:

Hubspot::Api::Error: {"status":"error","message":"Object type 2-5555555 is currently used in 3 places and cannot be deleted","correlationId":"XYZ","context":{"objectTypeId":["2-5555555"],"usageCount":["3"]},"category":"VALIDATION_ERROR","subCategory":"InboundDbObjectTypeError.CANNOT_DELETE_OBJECT_TYPE_IN_USE"}


DELETE  /crm/v3/schemas/pXYZ_name_of_type/purge
DELETE  /crm/v3/schemas/2-5555555/purge
response:

Hubspot::Api::Error: {"status":"error","message":"Couldn't find soft deleted object type(s) for: ObjectTypeId{metaTypeId=2, innerId=5555555}","correlationId":"XYZ","category":"VALIDATION_ERROR"}


After this https://legacydocs.hubspot.com/docs/methods/crm-extensions/delete-object-type 
response:

Hubspot::Api::Error: {"status":"error","message":"This hapikey (XXXXXXX) does not have proper permissions! (requires all of [developers-write])","correlationId":"XYZ"}


GET  /crm/v3/schemas/pXYZ_name_of_type
GET  /crm/v3/schemas/2-5555555

response

{"results":[]}

 

GET  /crm/v3/schemas/pXYZ_name_of_type + { archived: true }
GET  /crm/v3/schemas/2-5555555 + { archived: true }

response

{\"status\":\"error\",\"message\":\"Paging through deleted objects is not yet supported for object type 2-555555 (property_search)\",\"correlationId\":\"XXXXXXX\",\"category\":\"VALIDATION_ERROR\"}



How to delete custom type? How to find places where object type is still used?

 

0 Upvotes
1 Accepted solution
LeeBartelme
Solution
HubSpot Employee
HubSpot Employee

Delete custom type

SOLVE

In HubSpot you need to delete all the records for the custom object. After that, I would go into the properties for the custom object (the place where you can add new properties) and look at the used in column. Clicking on those numbers will show you where those properties are used in HubSpot. After you remove the references from those locations, you should be able to delete the schema.

View solution in original post

2 Replies 2
LeeBartelme
Solution
HubSpot Employee
HubSpot Employee

Delete custom type

SOLVE

In HubSpot you need to delete all the records for the custom object. After that, I would go into the properties for the custom object (the place where you can add new properties) and look at the used in column. Clicking on those numbers will show you where those properties are used in HubSpot. After you remove the references from those locations, you should be able to delete the schema.

barteksonarhome
Contributor

Delete custom type

SOLVE

Thanks for your answer! It's still hard to find something when the custom type has a hundred properties, but is better than nothing. In my case, I have workflow connected with a custom object. It would be much easier if the API informed us about it.

0 Upvotes