Data is accessing from one object to another object .
Salesforce provides 6 different types of relationship :
- Lookup Relationship
- Master-Detail Relationship
- External Lookup Relationship
- Self Relationship
- Many to Many Relationship
- Hierarchical Relationship
Lookup Relationship :
- we can create max 40 lookup relations(including 2 master details)per object
- This relation is supporting standard and custom objects
- We can create lookup for empty object(without records and also with records)
- In lookup relation parent and child contains it’s own owner
- It cannot support inheritance in OWD and sharing rules
- It cannot support rollup summary
- In lookup parent record is deleted, child field value is deleting. But not record
- In lookup relation parent field value optional
Master-Detail Relationship :
- We can create max 2 master details relationship per objects
- Master details is supporting only custom object
- We can create master detail relationship only in the empty object, because parent field value is mandatory
- Note: if any object contain any record first create lookup relation then fill all parent field value and change relationship type lookup to master detail
- Parent and child is controlled by parent it means parent object only contains ownership on child records
- It support inheritance in OWD and sharing rules
- It support rollup summary
- In master detail parent record is deleted, Associated child record also deleted because parent field value is mandatory
- Note: This rule is applicable up to 200 Childs. If any parent is associated with 200 or more then we cannot delete parent record
- In lookup relation parent field value mandatory
External Lookup Relationship:
Maintain the relationship from salesforce object to External Data base ( Sql-Server / Oracle).
Self Relationship:
An Object is related to same Object .
Supplier –> Supplier
Object —— Lookup/ Master-Detail ———Object
Many to Many Relationship:
you cannot create Many to Many relationship directly on object .
you can create it by using “Junction Object “.
Junction Object:
Any object having two Master-Detail relationship, for that object we called as Junction object.
Hierarchical Relationship:
Accessing / viewing of data top-level management to Low-level mangement. Ex: Role