I created a custom object called ‘Project’ and linked it to another object called ‘Task’ using a Master-Detail relationship. When we create MDR between two objects, the child record cannot exist without a parent.
Later, we decided that tasks should not be completely dependent on projects. Instead, tasks should exist on their own even if the project is deleted.
To achieve this, you need to delete the Master-Detail Relationship between Project and Task and replace it with a Lookup Relationship.
In this article, we will learn how to delete a master-detail relationship in Salesforce. We will provide an overview of the master-detail relationship and discuss important considerations to keep in mind when deleting it.
Master-Detail Relationship in Salesforce
When we create a master-detail relationship between two objects, the master side object is the parent object, and the details side object is the child object.
In MDR, the child object record does not exist without a parent. This means that whenever we delete the parent object record, the associated child record is also deleted along with the parent record.
For example, for the hospital, we created the master object named Department, and in that, we have one record, the ENT Department.
Then, we have another child object named Doctor’s Details, which contains records of doctor details associated with the ENT department.
Now, whenever we delete the ENT Department record from the Department (master) object, all the associated doctors’ details records get automatically deleted from the child object.
Deleting Master-Detail Relationship in Salesforce
When we attempt to delete the master-detail relationship, it sometimes displays an error stating that the field cannot be deleted. This happens because we had created a rollup summary field on the parent object.
In Salesforce, deleting the master-detail relationship is quite tricky, but it is possible to do so. First, we need to delete that rollup summary field, and then we will be able to delete the master-detail relationship in Salesforce.
If the master-detail field has been used in the Visualforce pages, then we cannot delete the master-detail relationship.
Delete a Master-Detail Relationship in Salesforce
Below, I will explain the steps to delete a master-detail relationship in Salesforce or convert a master-detail relationship into a lookup.
- When you log in to the Salesforce org, the Object Manager tab will be visible on the Home Page.
- Click on it, and in the search option, search for the object on which you want to delete the master-detail relationship.
- Here, I have selected the Student_c custom object. Click on that object.

- Then, you will see the Fields and Relationship option, in which we manage the datatypes, labels, and API names of fields. You can see the Faculty field with the Master-Detail relationship that we want to delete.
- To do this, click on the dropdown arrow located on the right side of the screen. Then, click on it, and you will see the “Edit” and “Delete” options. Click on the Delete option.

- After clicking the delete option, a window will pop up, displaying instructions. Then, click the Delete button.

- However, sometimes you may encounter an error stating ‘Unable to Complete the Requested Change,’ along with the reason and the section where the error occurred.
- Here, we can see that the error occurred in the Faculty Custom Fields section: All Student Count. This is the roll-up summary field.

- Let’s check on the parent object to see if its roll-up summary is present or not. For that, go to Object Manager -> Search Faculty (Parent object of Student_c).

- In the Fields and Relationships section, we can see the Rollup summary field. We need to delete that field. To do so, click on the dropdown arrow, and you will see the option to delete.
- Click on the Delete option, and then you will see that the field is deleted. Here, you should be aware of one important thing: we need to hard delete the rollup summary field, which can be found in the Deleted Fields option. Click on it.

- Then, you will see the “Erase” and “Undelete” options. We need to delete that field permanently, so click on the Erase option.

- After deleting the rollup summary field, we need to repeat steps one to three again, as we have already seen. As you click on the Delete button, you will see that the Master_Detail Relationship field will be deleted successfully.
Conclusion
I hope you now have an idea about deleting the master-detail relationship in Salesforce. We have reviewed the master-detail relationship and the key considerations to keep in mind when deleting it.
Additionally, we have seen step-by-step how to delete master-detail relationships in Salesforce Lightning.
You may like to read:
- Create Master-Detail Relationship in Salesforce
- Convert Lookup Relationship into Master-Detail Relationship in Salesforce
- Convert a Master-Details Relationship into a Lookup in Salesforce
- Delete Custom App in Salesforce
I am Bijay Kumar, the founder of SalesforceFAQs.com. Having over 10 years of experience working in salesforce technologies for clients across the world (Canada, Australia, United States, United Kingdom, New Zealand, etc.). I am a certified salesforce administrator and expert with experience in developing salesforce applications and projects. My goal is to make it easy for people to learn and use salesforce technologies by providing simple and easy-to-understand solutions. Check out the complete profile on About us.