Interview questions: Object Relationships Flashcards

1
Q
  1. What is the relationship in SF?
A

Connecting different objects with each other to replicate a real-life scenario/business
process is called a relationship.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  1. Why salesforce need object relationship?
A

To derive values and to prevent data inconsistency and repetition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  1. What are types of relationships in SFDC?
A

The Most common Relationships in SFDC are;
❖ Lookup Relationship
❖ Master Detail Relationship
❖ Many-to-Many Relationship

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
  1. What is a Lookup Relationship?
A

❖ 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  1. What is a Master-Detail Relationship?
A

● 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
  1. What is Many-to-Many relationship in Salesforce?
A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
  1. What is a junction object?
A

● 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
  1. What is roll-up summary?
A

● 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
  1. What are functions of Roll-up summary field?
A

● 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
  1. What are various characters of Roll-up Summary fields?
A

● 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
  1. Is it possible to edit Roll-up summary field value in a record?
A

No, roll-up summary fields are read-only fields and they can not be edited.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
  1. Is it possible to create Roll-up summary field on parent object?
A

Yes, we can create Roll-up summary field on parent object only with Master-Detail
relationship between objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
  1. Can we convert the Lookup relationship to Master Detail Relationship? If so how can we convert ?
A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
  1. What happens to Detail record when Master record is deleted?
A

Whenever Master record is deleted, its detail records will also be deleted. This is called
cascade-delete.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
  1. What happens to Child record when a Parent record is deleted in Lookup
    Relationship?
A

When a master record is deleted in Lookup Relationship, child records are not be
deleted. So there is no cascade delete in Lookup relationship.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
  1. What is the limitation for Lookup and Master-Detail Relationship per object?
A

You can have a maximum of two master details on an object.
For look-up relationship, You can have a maximum of 40 lookups per object.

17
Q
  1. Although Account and Contact have a lookup relationship in Salesforce, why do
    related Contacts(child) get deleted when the parent Account is deleted?
A

We have Standard Relationships between Account and contact -it behaves as master
detail in business logics but on UI it is a lookup relationship, Though Contacts and
Accounts have a lookup relationship but this relationship has a property called
CascadeDelete set to true. This is why the contact is deleted when the parent object is
deleted.

You can create a contact without an account and such contacts are private so you
won’t be able to use them in reports and all. This shows that it is a Look up relation.

If you have created a contact with account and you delete that account then contact will be deleted, this shows that it is in Master-Detail relationship.

18
Q
  1. What is the difference between Master-detail and Look-up relationship?
A