3

I was going through a set of questions for Salesforce Certification and the below question is something where I would like to verify my answer.

Question: A company has a custom object named Warehouse. Each Warehouse record has a distinct record owner, and is related to a parent Account in Salesforce. Which kind of relationship would a developer use to relate the Account to Warehouse?

Options:

  • Parent-Child
  • Master-Detail
  • Lookup
  • One-to-Many

I thought the answer as Lookup, but it is telling me the correct answer is: One-to-Many. What do you think? I don't think we have any One-to-Many relationship in Apex?

Ref: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/relationships_among_objects.htm

3
  • The certification is telling you that One-to-Many is correct? Or just a study guide?
    – sfdcfox
    Commented Nov 25, 2016 at 20:54
  • @sfdcfox I was going through a mock quiz and there it wss telling this answer. Which seems wrong to me. Commented Nov 25, 2016 at 20:56
  • Was it a SFDC mock quiz? If so, can you share the link? If it wasn't a SFDC mock quiz, I wouldn't bet on the answer being right, despite sfdfox's answer. Commented Dec 14, 2016 at 20:32

2 Answers 2

5

The test writers are looking for the Account's relationship to the Warehouse, not the Warehouse's relationship to the Account. That means you have to plug in each word to determine which correctly describes the relationship. Examine the following four sentences.

The Account has a Parent-Child relationship to the Warehouse.

The Account has a Master-Detail relationship to the Warehouse.

The Account has a Lookup relationship to the Warehouse.

The Account has a One-to-Many relationship to the Warehouse.

Clearly, since many Warehouse records can belong to a parent Account, both Lookup and Master-Detail are immediately eliminated.

The remaining two choices, Parent-Child and One-to-Many are actually opposites. This is because hyphenated relationships like Parent-Child and Master-Detail refer to the "other" object first, then to the object in question. For example, we often say the following:

The Warehouse has a Parent-Child relationship to the Account.

The Warehouse has a Lookup relationship to the Account.

The Warehouse has a Master-Detail relationship to the Account.

The only choice left is where we have One-to-Many:

The (One) Account has (Many) Warehouse records.

This question is intentionally deceptive by mentioning things like Ownership, which from the Account's perspective, doesn't matter. Unfortunately, this type of question is one of those that you'll want to think about carefully and re-read a few times. Certification questions sometimes require a bit of lateral thinking, such as what you'd have to do if you were an actual developer.

1
  • 1
    This is great explanation!
    – javanoob
    Commented Nov 26, 2016 at 20:32
0

The right answer is "Lookup".

Explanation:-

We know it cannot be M-D (Master-Detail) because the question specifically states "Each Warehouse record has a distinct record owner" and we know that M-D follows a one-to-many relationship model, such as Account and Contact (i.e. One Account may have many Contacts).

In addition, there is no such relation label called "one-to-many" in SF, so we can eliminate options master-detail and one-to-many.

The option parent-child means that "Account has a parent-child relation with Warehouse". What this actually means is that Account is the child object and Warehouse is the parent object. That does not satisfy our requirement since it is given that "each Warehouse record is related to a parent Account". Thus we can also eliminate the option Parent-Child.

The remaining option Lookup is our answer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .