function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
shasha777shasha777 

How to create 1-M relationship and M-1 relationship?

Hi to all,

 

. How to create 1-M relationship and M-1 relationship in SFDC?

vin_devvin_dev

We can create one to many relationship using Master - Detail relationship

gautam_singhgautam_singh

To create a one to many relationship, create a new custom field of type "Look Up" on the child object (the many side of the relationship) to the parent object (the "one" part of the relationship).

There are 3 types of relationships that can be created in Salesforce  master-detail, lookup, and hierarchical.  Each of these relationships is a one to many relationship.

Master-Detail

    A detail record must be linked to a master record in order to save the record (e.g. you must link an opportunity to account to save the opportunity).
    Only one level deep – a detail object cannot also be a master object.  Please vote to remove this limitation: Multiple Master-Detail relationships.
    A detail record can have two different master records (two master-detail relationships must be created).
        
Lookup Relationship

    One to Many relationship links one record to another record.
    Can link standard to custom objects and vice versa, or link to the same object type (parent account, for instance).

Hierarchical

    A lookup relationship on the user object to the user object (for instance the standard field “Managerâ€�).
    Record cannot point to itself (I cannot be my own manager).



Important :

Hit Kudo's if you find useful information from this post and if is the solution to your answer please mark it as a solution .