How To Delete A Custom Salesforce Object? (Common Issues Addressed)

Photo of author
Jerome Clatworthy

Certified Salesforce Administrator

Though it is impossible to delete Standard Salesforce Objects, it is possible to delete custom Objects. In this article, I will show you the two different ways custom objects can be deleted and also troubleshoot common issues that occur when trying to delete a custom object.

Things To Do Before You Delete A Custom Object

Before you delete a custom Object you should back up the data contained in that Object in case you need it in the future, or in case you change your mind and want to re-create the Object.

You could export the Object in multiple different ways:

  • Create a Salesforce Report for that Object that includes all fields and all records, and export the report.
  • Use a Data Management tool such as Data Loader, or Workbench and use SOQL to export all fields and records from the object.

Deleting a Custom Object in Salesforce

There are two primary ways to delete a custom Salesforce Object. You can delete custom Objects through the Object Manager, or through the Schema builder. I will explain both options below and provide accompanying screenshots and instructions.

Deleting a Custom Object in Schema Builder

Open the Salesforce Schema Builder by selecting the gear icon, and choosing Setup. Type ‘schema’ into the quick find box and then choose Schema Builder.

Sceenshot of Salesforce Setup area.
Open Schema Builder

Find your Object from the list and select it, to see your Object appear on the Schema Builder canvas.

Screenshot of Salesforce Schema Builder canvas.
Select your custom object

Select the gear icon, from the custom Object on the Chema Builder canvas, and choose Delete Object.

Screenshot of Salesforce Schema Builder canvas with an object being edited.
Select the gear icon, then ‘Delete Object’

Read the provided information regarding the impact of deleting a custom object, check the confirmation box, and select Delete to proceed.

Screenshot of Salesforce 'Delete Object' implications warning message.
Confirm, and select ‘Delete’

You will notice that the Object has disappeared from the list of Objects, and no longer appears on the Schema Builder Canvas.

You will still be able to find the Object in the deleted Objects list for 15 days and restore it. But after 15 days the custom object will be permanently deleted.

Deleting a Custom Object Using Object Manager

Open the Salesforce Object Manager by selecting the gear icon, choosing Setup, then selecting Object Manager.

Screenshot of Salesforce Setup area.
Select ‘Setup’, then Object Manager

Scroll down the list of Objects until you see the custom Object you want to delete. Select the downward pointing arrow on the right-hand side of the row, and choose Delete.

Screenshot of Salesforce Object Manager
Choose ‘Delete’ from the drop-down list

Before deleting the Object, Salesforce will ensure you understand the implications of deleting a custom object. Read through the list and select OK.

Screenshot fo Salesforce 'Delete Object' warning message.'
The implications of Deleting a Custom Object

After proceeding with the Delete, as described in the message above, the Object will no longer appear in the Object Manager, but you can still access it via the deleted objects list for 15 days before being permanently deleted.

Why Can’t I Delete a Custom Salesforce Object?

The main reason you might have trouble deleting a custom Object is when that Object has a lookup relationship to other objects.

In this example, in a Trailhead Playground Org, I created a custom salesforce object called ‘Coffee’ which lists a variety of different types of coffee (and relevant details of each type).

Screenshot of Salesforce custom object in Object Manager.
The ‘Coffee’ custom object

I created a lookup field on the Contact object, so I can easily store a Contact’s coffee preference. Because of this, if I try and delete the Coffee object I get this deletion problem message:

Your attempt to delete {custom object} could not be completed because it is associated with the following relationships with other objects.

Screenshot of Salesforce deletion problem message.
Cannot delete while the object relationship exists

As long as this lookup field on the Contact Object is in place, then I will not be able to delete this Custom Object.

Screenshot of Salesforce field list on the Contact Object in the Object Manager.

However, even after deleting this field on the Contact object, I still receive the same message.

Screenshot of Salesforce deletion problem message.

The reason for this, and where most people encounter this error, is because the related fields need to be ‘hard deleted’. The hard delete takes place 15 days after the initial deletion of the field, similar to deleted Objects.

Screenshot of Salesforce Object Manager.
Select ‘Delete Fields’

You can either wait for 15 days to pass, after which time you will be able to delete the custom object or speed up the process by selecting Erase on the field.

Screenshot of Salesforce Contact Object Deleted Fields screen.
‘Hard Delete’ the field if you want to speed up the process

Once all related fields have been ‘hard deleted’ you will be able to finish the process of deleting your custom object.