in Technology by
What are the different types of object relations in salesforce? How can you create them?

1 Answer

0 votes
by

No list of Salesforce interview questions is complete without involving relationships between objects in Salesforce. Relationships in Salesforce can be used to establish links between two or more objects.

The different types of object relationships in Salesforce are:

Master-Detail Relationship (1:n):- It is a parent-child relationship in which the master object controls the behavior of the dependent child object. It is a 1:n relationship, in which there can be only one parent, but many children.The main concept you need to be know is that, being the controlling object, the master field cannot be empty. If a record/ field in master object is deleted, the corresponding fields in the dependent object are also deleted. This is called a cascade delete. Dependent fields will inherit the owner, sharing and security settings from its master.You can define master-detail relationships between two custom objects, or between a custom object and standard object as long as the standard object is the master in the relationship.

Lookup Relationship (1:n):-

Lookup relationships are used when you want to create a link between two objects, but without the dependency on the parent object. Similar to Master-Detail relationship, you can think of this as a form of parent-child relationship where there is only one parent, but many children i.e. 1:n relationship.The difference here is that despite being controlling field, deleting a record will not result in automatic deletion of the lookup field in the child object. Thus the records in the child object will not be affected and there is no cascade delete here. Neither will the child fields inherit the owner, sharing or security settings of its parent.

Junction Relationship (Many-To-Many):-

This kind of a relationship can exist when there is a need to create two master-detail relationships. Two master-detail relationships can be created by linking 3 custom objects. Here, two objects will be master objects and the third object will be dependent on both the objects. In simpler words, it will be a child object for both the master objects.

Related questions

0 votes
    What are the different types of apps we can use in Salesforce?...
asked Jun 25, 2021 in Technology by JackTerrance
0 votes
    What are the different types of reports available in Salesforce? Can we mass delete reports in Salesforce?...
asked Nov 11, 2020 in Technology by JackTerrance
0 votes
    What are the different types of email templates that can be created in Salesforce?...
asked Nov 11, 2020 in Technology by JackTerrance
0 votes
    How can you create many to many relationships under salesforce? (1)Creating direct many to many relationships (2) ... (4)Not possible to create many relationships in salesforce...
asked Aug 26, 2021 in Technology by JackTerrance
0 votes
    How can you create many to many relationships under salesforce? 1. Using a piece of code to relate both ... in salesforce 4. Creating direct many to many relationships...
asked Jun 27, 2021 in Technology by JackTerrance
0 votes
    What are the different types of email templates available in Salesforce?...
asked Jun 26, 2021 in Technology by JackTerrance
0 votes
    What is a sandbox org? What are the different types of sandboxes in Salesforce?...
asked Nov 11, 2020 in Technology by JackTerrance
0 votes
    What are the different types of reports available in Salesforce?...
asked Jun 25, 2021 by JackTerrance
0 votes
    How to insert different types of slides and images into the slides and apply animation and transition on them Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    A __________ is an R-object which can contain many different types of elements inside it. (a) Vector (b) ... Out of R Programming Select the correct answer from above options...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    What all data types can a set store in Salesforce?...
asked Nov 11, 2020 in Technology by JackTerrance
0 votes
    What is an external ID in Salesforce? Which all field data types can be used as external IDs?...
asked Nov 11, 2020 in Technology by JackTerrance
0 votes
    What are the types of iOS binaries you can create using XCode? (.app, .ipa, .a, .framework)...
asked Nov 10, 2020 in Technology by JackTerrance
0 votes
    What are the different memories you know about? Which of them takes the shortest access time? Select the correct answer from above options...
asked Dec 29, 2021 in Education by JackTerrance
...