How to Delete a Master-Detail Relationship in Salesforce : Bijay Kumar
by: Bijay Kumar
blow post content copied from SalesForce FAQs
click here to view original post
### Summary of the Content The article discusses how to delete a Master-Detail (MDR) relationship in Salesforce, specifically between two custom objects: 'Project' and 'Task'. Initially, the Task object was dependent on the Project object, meaning if a Project was deleted, all associated Tasks would also be deleted. However, the need arose to make Tasks independent of Projects, which requires changing the relationship from Master-Detail to Lookup. #### Key Points: 1. **Master-Detail Relationship**: In Salesforce, this type of relationship means the child record (Task) cannot exist without the parent record (Project). Deleting the parent automatically deletes the child. 2. **Changing Relationships**: To make Tasks independent, the Master-Detail relationship must be deleted and replaced with a Lookup relationship. 3. **Steps to Delete MDR**: - Access the Object Manager in Salesforce. - Locate the object with the Master-Detail relationship. - Attempt to delete the relationship; if an error occurs (often due to a rollup summary field), it must be deleted first. - Permanently delete the rollup summary field from the parent object. - Repeat the deletion process for the Master-Detail relationship. 4. **Common Errors**: Errors may arise if the MDR is used in Visualforce pages or if rollup summary fields are present. 5. **Conclusion**: The article provides a clear guide on how to delete a Master-Detail relationship in Salesforce, emphasizing the importance of understanding the implications of such relationships. ### Additional Context Master-Detail relationships are crucial in Salesforce for maintaining data integrity and hierarchy. However, there are scenarios where flexibility is needed, such as when tasks need to be managed independently of projects. Understanding how to manipulate these relationships is essential for Salesforce administrators. ### Hashtags for SEO #Salesforce #MasterDetailRelationship #LookupRelationship #SalesforceAdmin #DataManagement #SalesforceTutorial #CRM #SalesforceTips #SalesforceLightning #SalesforceDevelopment
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
The post How to Delete a Master-Detail Relationship in Salesforce appeared first on SalesForce FAQs.
September 18, 2025 at 11:12PM
Click here for more details...
=============================
The original post is available in SalesForce FAQs by Bijay Kumar
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Post a Comment