Developer Bytes | Custom Objects with Zack Wolfson | Part 3: Deleting a Custom Object

Zack Wolfson walks through how to delete and archive custom objects in HubSpot's CRM. The video covers the technical steps and considerations for removing objects you no longer need from your system.
Okay, we made it. This is the final part of our custom object series with Zach Wolfson. Just to briefly recap, in part one, we talked about what an object is and how custom objects fit into the puzzle. Part two was all about modifying custom object and adding associations. And now, drum roll.
Part three, deleting it. Okay, okay.
Jeez, Dennis, enough of your reaming. Let's go back to Zach. All right, and last, let's say we're done with this custom object. What's the process there?
So now what we want to do is we want to remove it. All right? So in order to do that, we need to archive it. So we're going to make a delete call the name CRM V3 schema and do object type ID and let's make sure we go buying and we'll delete it. Oops.
Station.
Like that. Okay. Oh, because I added in as a header. Okay, so now is pretty smart. So it's going to stop me from deleting a schema where things already exist. So I'm going to do is I'm going to go ahead and delete this car that I created. Okay. And now I have no cars. Let's get rid of that weird extra one. Great. And we are going to go run that call again. Great. So now I've got the expected 204no content. Now, this schema hasn't actually been fully deleted. It's been put into an archive state. Okay. Now if I really want to get rid of it, I can go ahead and add a new param here, say archived true. So now I'm interacting with just the archived objects I can kind of show here. Why don't I do that? Let's do a get first, just to kind of show that it's there while.
You'Re putting that together. Do it. If I want to unarchive it. Is it possible at this point?
Yes. Yes. So all you have to do is pass that and change the archive status. True. There we go. See, it's here. It is archived, but it is still restorable. We tell you that right. As part of the schema. But let's say I really do want to get rid of it. I'll make this delete call again with archive true. And now it's really gone. So I'll make the API call again and I no longer have a schema created here. Perfect.
And so HubSpot, as you said, is pretty smart about this. So there's. Is there anything I should be worried about when I'm deleting this. Is there any other gotchas I just need to be worried about?
The only other gotcha right now that you do want to be careful of is if you have any forms that are using custom object properties. Because one of the things you can do is you can just use a regular hub form and bring in custom object properties as a part of that, which is really nice. You can get customers to kind of fill in information for you, create a new instance of that. Just make sure you go back and clean up those field properties. It will stop you from deleting it if there's a current usage of it. But just because that can affect your public website, you do own just the extra careful that you don't accidentally break the customer experience there. Great.
Zach, this has been amazing. Thank you. I think this is very. You clearly walk through custom objects and I think this is going to be very beneficial. If any of you guys have questions about this, please feel free to reach out in the community and we are always here to make this a better experience for you. Zach. Thanks. Have a great day.
My pleasure. You too.










