How to create Master-Detail relationship in Salesforce: In this training tutorial, we are going to create and gain some knowledge on how to create a Master-detail relationship in salesforce between objects. In our previous training tutorial we learned about different types Relationships in Salesforce and their characteristics.

Relationship is the way in which two or more people or things connected with each other. Here Master Object is also called “Parent Object” and Detail Object also called “Child Object“.

Characteristics of Master-Detail Relationship

  • Child record must have a  associated parent.
  • Cascade record-level security.
  • Cascade record deletion.
  • Roll-up Summary fields can be established.
  • Standard objects can not be a detail object.
  • Standard Objects can be a Master object
  • Maximum 2 Master-Detail Relationships can be created to a Object.
  • Records can be re parented.

Now we are going to create Master-Detail Relationship between Custom College Object, Student Object, Course Object and Employ Objects. In this example we are taking Custom College Object as Master or Parent object. And Student Object, Course Object and Employ Objects will be child Objects or Detail objects for Custom College Object(Parent or Master object).

 How to create Master-Detail relationship in salesforce.

In the first go to detailed view of Custom student Object.Then go to custom fields and Relationships section.

Detailed view of Object => Custom fields and Relationships => New => Select Master-Detail Relationship

How to create Master-Detail relationship in Salesforce

Now select New. Now we are taken to new window to selected Related to Object(Master Object). In the Picklist select custom College object.

How to create Master-Detail relationship in Salesforce

Now Select Next Button again we are taken next step where we are required to give Field Label, Field Name, select sharing setting and Allow child records to be re parented.

How to create Master-Detail relationship in Salesforce

Select Next and in next step make the field-level security for reference field. and select next.

How to create Master-Detail relationship in Salesforce

How to create Master-Detail relationship in Salesforce

In the next Step Save it.

How to create Master-Detail relationship in Salesforce

Go to Student Object in detail view which we observe Master-Detail Relationship is created between College and Student Object. Like wise create Master-Detail relationship between College-Course, College-Employ Objects. Make College object as Master Object.

Now go to  College Tab to create new record in College object.

How to create Master-Detail relationship in Salesforce

Enter College name and Save it.

How to create Master-Detail relationship in Salesforce

Now got to detail view of the record and we observe Student object, Dept Object and Course Objects as Child Objects for College Object(Master or Parent Object).

How to create Master-Detail relationship in Salesforce

Note : For an Object with a Master-Detail Relationship field the standard field called Owner Field can not be available. The Owner of the Master record becomes the owner of the child record.