How to Convert Master-Details Relationship into Lookup in Salesforce

In Salesforce, we can create only two master-detail relationships on the same object; sometimes, it isn’t important to have an MDR relationship on the object, so instead, we can convert it into the lookup relationship.

In this Salesforce tutorial, we are going to learn about converting the master-detail relationship into the lookup relationship; we will see the lookup relationship, MDR(Master-Detail relationship), and why there is a need to convert the relationship.

Additionally, we will see how to convert the master-detail relationship into a lookup relationship in Salesforce Lightning and Salesforce Classic.

Master-Details Relationship into Lookup in Salesforce

Lookup Relationships in Salesforce:

Using the following points, let’s quickly give an overview of lookup relationships:

  • Two types of relationships – one-to-many and many-to-many.
  • Not necessary to have a lookup field required.
  • We can create up to 40 LR per object.

Master-Detail Relationships in Salesforce:

Using the following points, let’s quickly give an overview of master-detail relationships:

  • Only one-to-many type of relationship.
  • The Master Detail field is always required to be filled.
  • We can create only two MDRs per object.
  • We can use the Rollup Summary field on the parent object in MDR.

Why do we need to convert the master-detail relationship into the lookup relationship in Salesforce?

In Salesforce, we can create only two master-detail relationships per object, and because of MDR, we can use the roll-up summary field. Also, sometimes, it isn’t important to have an MDR relationship on the object, so instead of that, we can convert it into the lookup relationship.

See also  External Lookup Relationship in Salesforce

Important:

While converting the Master-detail relationship into a Lookup Relationship, we should consider that if we have created any rollup summary field on the parent object, then we need to delete that field, or else it will not convert into a lookup relationship.

How to Convert Master-Details Relationship into Lookup in Salesforce Lightning

Using the following steps, we can convert the master-detail relationship into a lookup Relationship.

1. As you log in to Salesforce.org, on the Home Page, you will see the Object Manager tab.

Click on it, and in the search option, search for the object that you want to convert to the field relationship. Here, I have selected the Student_c custom object. Click on that object.

Example of convert Lookup relationship into master detail relationship in Salesforce

2. 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 change in the lookup relationship. Click on that field.

Convert MDR into LR in Salesforce Lightning

3. You will see the Edit option; click on it.

Convert master detail into lookup relationship in Salesforce

4. But we don’t have the option to change the field type; why did this happen?

As we discussed above, if there is a rollup summary field present on the parent object, it will not convert into a master-detail relationship.

Converting Lookup relationship into master detail relationship in Salesforce Lightning

5. Let’s check on the parent object to see if their roll-up summary is present or not. For that, go to Object Manager -> Search Faculty_c (Parent object of Student_c). -> Fields and Relationship -> Here, we can see the Rollup summary field is there.

Convert MDR into LR in Salesforce

6. We have to delete that field; for that, 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.

Lookup and Master detial relationships in Salesforce

7. Here, you should know one important thing: we have to hard delete the rollup summary field, which you can see in the Deleted Fields option. Click on it.

Example of convert Lookup relationship into master detail relationship in Salesforce Lightning

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

convert Lookup relationship into master detail relationship in Salesforce example

9. Then again, go to the Edit option on Student_c (child object). Now, there, you can see the Change Field Type option; click on it.

How to convert master detail into lookup relationship in Salesforce

10. Now click on the Lookup Relationship datatype and click on the Next button.

convert Lookup relationship into master detail relationship in Salesforce Lightning example

11. Then don’t change anything here; directly click on the Save button.

How to convert MDR into LR in Salesforce

12. Here, you can see in the Faculty field that the master-detail relationship has been converted into a lookup relationship.

Convert master detail into lookup relationship in Salesforce Lightning

This is how we can convert the master-detail relationship into the lookup relationship in Salesforce Lightning.

See also  Effects when Auto Number Field Exceeds the Specific Digits in Salesforce

How to Convert Master-Details Relationship into Lookup in Salesforce Classic

Using the following steps, we can convert the master-detail relationship into a lookup Relationship.

1. In Salesforce Classic, on the Setup page, you will see the + Plus icon in the right corner; click on that icon. As you click on the + Plus icon, you will see All Tabs displayed on your screen.

Select the tab on which you want to convert MDR into a lookup relationship From these Tabs. Here, I have selected the Manager Tab.

Convert master detail relationship into lookup relationship in Salesforce Classic

2. After clicking the object, You will see an arrow on the right side of the screen; click on that arrow. Then you can see the View Fields option is there, click on that option.

How to convert MDR into lookup in Salesforce Classic

3. Here, you can see in Custom Fields & Relationships that the Assigned HR field has a Master-Detail Relationship Data Type. Click on the Edit button on the Assigned HR field.

How to convert master detail relationship into lookup relationship in Salesforce Classic.jpg

4. You can see the Change Field Type button; click on that to change the relationship between two objects.

Convert master detail relationship into lookup example in Salesforce

5. We have to change the master-detail relationship in the lookup, so for that, click on the Lookup Relationship option and then click on the Next button.

Converting master detail relationship in Lookup relationship Salesforce Classic

6. Do not change any field; click the Save button to make changes.

Example of Convert master detail relationship into lookup in Salesforce

7. Here we can see the master-detail relationship successfully changed into the lookup relationship.

How to convert master detail relationship into lookup relationship in Salesforce Classic.jpg

This is how we can convert the master-detail relationship into the lookup relationship in Salesforce Classic.

Conclusion

I hope you got an idea about converting the master-detail relationship into the lookup relationship, in that we have seen the lookup relationship, MDR(Master-Detail relationship), and why there is a need to convert the relationship.

See also  Manage Territories and Territory Models for Opportunities in Salesforce

Additionally, we also have seen how to convert the master-detail relationship into a lookup relationship in Salesforce Lightning and Salesforce Classic.

You may like to read: