Pages

Wednesday 3 February 2016

Interview Questions : relationships

Interview Questions : relationships


 How many relationships included in SFDC & What are they? 
We are having three types of relationships, they are
Lookup Relationship
Master-Detail Relationship
Many-to-Many relationship 
 What is a “Lookup Relationship”?
Up to 25 allowed for object
Parent is not a required field.
No impact on a security and access.
No impact on deletion.
Can be multiple layers deep.
Lookup field is not required.
 What is “Master-Detail Relationship”?
Master Detail relationship is the Parent child relationship. In which Master represents Parent and detail represents Child. If Parent is deleted then Child also gets deleted. Rollup summary fields can only be created on Master records which will calculate the SUM, AVG, MIN of the Child records.
Up to 2 allowed to object.
Parent field on child is required.
Access to parent determines access to children.
Deleting parent automatically deletes child.
A child of one master detail relationship cannot be the parent of another.
Lookup field on page layout is required.
Does an object can have both relationships (Lookup Relationship & Master Detail Relationship) at a time?
Yes, single object can have both relationships at a time.
What is a “Self Relationship”?
A self Relationship is a lookup relationship to the same object.
Suppose let’s take an object “Merchandise”. Here we can create relationship in between the Merchandise to Merchandise (same object) object. That is called “Self Relationship”.
What is “Many to Many Relationships”?
Allow for the relationship of two objects in a many-to-many fashion.
How we achieve the “Many-to-Many Relationship”?
By using Junction Object we can achieve this relationship, here junction object is having Master- Detail Relationship with different objects (Ex.Students & Courses). Using this Master to Detail Relationship, we can create the Many-to-Many Relationship in between the objects.
 What are the main things need to consider in the “Master-Detail Relationship”?
Record level access is determined by the parent,
Mandatory on child for reference of parent, cascade delete (if you delete the parent, it can cascade delete the child).
What are the main things need to consider in “Lookup Relationship”?
Loosely coupled, not going to have all the above rules which are existed in master detail relationship.
Self relationship is always lookup to self relation object type. In many to many we actually create a junction object in the middle, it does lookup for the bound objects that are ultimately being bounded in a many to many way.
Can we convert the lookup relationship to Master Detail relationship?
Yes, We can convert the lookup relationship to master detail relationship only if all the existing record has valid lookup field values.
Can we create Master Detail relationship on existing records?
No. first we have to create the lookup relationship then populate the value on all existing record and then convert it.

No comments:

Post a Comment