Master-Detail Relationship

instagram | bugendaitech  Twitter | bugendaitech  Linkedin | bugendaitech

Master detail relationship defines the relationship between parent and child record. Master detail table relates the parent relation and the detail defines the child relationship. If the master detail table is deleted then the child records data is also deleted because they are directly dependent on the master table. The master-detail relationship has an object in a master-detail relationship and can also contain a  field type called a rollup summary. Rollup summary fields store values aggregated from the child records in master detail relationship.

For example: Sales Order example you could create an “Order Total” rollup summary field that automatically sums the amount of all line items. Rollup summary fields can either count records or min, max and sum specific fields which based upon all records or records meeting certain criteria for eg., matching record type, created date before today, Boolean value.



These are the main things that need to consider in the “Master-Detail Relationship”

  • Parent reference becomes mandatory for ‘‘child objects’’.
  • In Master details, standard objects can’t become child objects.
  • Master details relationship support cascading delete. If you delete the parent class, cascade auto  delete the child class

Many-to-Many Relationship

There are some scenarios where you will need to implement a many-to-many relationship where  a one record relationship can be associated with many records on the other side. Sometimes there are a lot of records in one object. In case this uses an intermediate object, which they refer to as a junction object, they deal with many objects at a time. In order to implement a junction object, we simply create a custom object and add two master-detail relationships to the objects on each side of the relationship.

Hоw  we  Сreаte  Mаster-detаil  Relаtiоnshiр

  • Create a minimum two custom оbjeсts
  • Сlісk оn оbjeсt  >  Click  “Quick  Ассess  Menu”  >  Аdd  “New  Field”.
  • Сhооse  Field  Type  (Mаster  Detаil  Relаtiоnshiр)  >  Next.
  • Select  the  аррrорriаte  Оbjeсt  оn  whiсh  the  relаtiоnshiр  shоuld  be  estаblished
  • Fill  in  the  detаils  аnd  рrосeed  tо  the  next  steр.
  • Рrоvide  with  аll  the  required  seсurity  level  сheсks  аnd  рrосeed  tо  the  next
  • With  the  аbоve  steрs,  the  MDR  relаtiоnshiр  is  estаblished.  The  belоw  ss  shоws.
Article Name
Master-Detail Relationship
What exactly is a master-detail relationship? How to create Master-detail relationship and what are the things to consider for using it. Know how Salesforce Professional services can assist you in this.
Publisher Name
BugendaiTech Pvt Ltd
Publisher Logo
Spread the updates

Leave a reply