You need to sign in to do that
Don't have an account?
:) :) :) :) :)
Salesforce Object Relationships
Hi All,
I have knowledge of different salesforce object relationships but can anyone give me better understanding with practical example among these different relationships. I might be wrong but I think we can also create junction object with lookup or master-detail but when should I use lookup and when should I use Master detail junction object?
I have knowledge of different salesforce object relationships but can anyone give me better understanding with practical example among these different relationships. I might be wrong but I think we can also create junction object with lookup or master-detail but when should I use lookup and when should I use Master detail junction object?
- Lookup
- Master-Detail
- Self (Hierarchical)
- Junction object using Lookup
- Junction object using Master-Detail.
The biggest difference IMHO is the ability to do Rollup calculations on a M/D relationship. M/D is the only way to do it declaratively - unless you implement something like Rollup Helper.
https://help.salesforce.com/apex/HTViewHelpDoc?id=overview_of_custom_object_relationships.htm&language=en (https://help.salesforce.com/apex/HTViewHelpDoc?id=overview_of_custom_object_relationships.htm&language=en)
There are some especially good points made about the technical ramifications of lookup vs master-detail relationship fields.
As for examples:
1. In a lookup relationship the child may or may not have a parent. A real world example of this is a dog may have an owner or it might be a stray.
2. A detail object record requires a parent record, but not the other way around. A real world example of this is a shadow must be cast from an object, but it's possible for an object to not have a shadow at high noon or in the dark.
3. It's possible for an organization to have a parent organization. For example, Google is now technically one company of many under Alphabet, the parent organization.
4. I wouldn't recommend creating a junction object via lookup relationships. Master-detail relationships are better suited for junction objects to prevent orphan records--by definition a junction object record should relate its two parents so neither should be allowed to be blank and lookup fields, unlike master-detail fields, are not required by default on the child object.
5. A job posting may have many candidates that apply and likewise the same candidate may apply to several job postings. In this case a junction object could be created using master-detail fields to create a many-to-many relationship between job postings and candidates.
Master-Detail and Lookup are very close to each other.
The biggest difference in the master-detail and lookup the Roll up summary is available in master-detail only
the master-detail is the best one to implement something like Roll up summary's
Suppose i have created junction object using master-details and if i am going to delete one of master record then what will happen?
Is it give me error or it will delete junction object record regardless of second master in still there?
How deletion will take place here?