Interview questions: Object Relationships Flashcards
- What is the relationship in SF?
Connecting different objects with each other to replicate a real-life scenario/business
process is called a relationship.
- Why salesforce need object relationship?
To derive values and to prevent data inconsistency and repetition
- What are types of relationships in SFDC?
The Most common Relationships in SFDC are;
❖ Lookup Relationship
❖ Master Detail Relationship
❖ Many-to-Many Relationship
- What is a Lookup Relationship?
❖ No parent is required
❖ Roll-up summary fields cannot be available
❖ One object can have only 40 lookup relationships. Salesforce can increase it to 50 on
request.
❖ There is no impact on security
❖ This relationship does not have any dependency.
- What is a Master-Detail Relationship?
● Child record must have an associated parent
● Cascade record deletion
● Cascade record-level security
● Roll-up summary fields are available
● One object can have maximum 2 Master-Detail relationships.
● Standard objects CAN NOT be a detail object
● Standard objects CAN be a master object
- What is Many-to-Many relationship in Salesforce?
A Many-to-Many Relationship allows each record of one object to be linked to multiple
records from another object and vice versa. Junction object is used to create Many-to-Many Relationship.
- What is a junction object?
● Junction object is a custom object which relates two other objects via two
Master- Detail Relationships.
● Junction objects give us a way to create Many-to-Many Relationship between
Salesforce objects.
● Junction object records are deleted and placed in the Recycle Bin when either
associated master record is deleted
● If both associated master records are deleted, the junction object record is
deleted permanently and can’t be restored.
- What is roll-up summary?
● A roll-up summary field calculates values from related records, such as those in
a related list.
● You can create a roll-up summary field to display a value in a master record
based on the values of fields in a detail record.
● The detail record must be related to the master through a master-detail
relationship
- What are functions of Roll-up summary field?
● Count: It calculates the total number of records
● Sum: It totals the values of selected fields
● Min: It displays the lowest value
● Max:It displays the highest value
- What are various characters of Roll-up Summary fields?
● Roll-Up summary field can only be created for Master-Detail Relationship, not for
Lookup
● It derives the data from Child object
● It will show in Master Object
● We can not change field type of a field that we reference in a roll-up summary
field
● Auto number are not available
● Roll-up summary fields are not available for mapping lead fields of converted
fields.
- Is it possible to edit Roll-up summary field value in a record?
No, roll-up summary fields are read-only fields and they can not be edited.
- Is it possible to create Roll-up summary field on parent object?
Yes, we can create Roll-up summary field on parent object only with Master-Detail
relationship between objects
- Can we convert the Lookup relationship to Master Detail Relationship? If so how can we convert ?
Yes, we can convert Lookup relationship to Master-Details relationship.
Conversion can be done only if all the fields have valid Lookup field values. To convert
lookup to the master-detail relationship you need to give parent record on all child
records. This is because a master-detail relationship does not allow for ‘orphaned’ child
records. Once you have a lookup with each child having a parent than you can go back
and convert the lookup field to a master-detail
- What happens to Detail record when Master record is deleted?
Whenever Master record is deleted, its detail records will also be deleted. This is called
cascade-delete.
- What happens to Child record when a Parent record is deleted in Lookup
Relationship?
When a master record is deleted in Lookup Relationship, child records are not be
deleted. So there is no cascade delete in Lookup relationship.