1

If I want to relate a custom object to the contact object such that the custom object will show in a related list in contacts.

On which object do I make the lookup field, the contact object or custom object or can I do it on either object?

Also, whichever gets the lookup field, is that the parent object of this relationship with respect to code? i.e. contact__r.customobjectfield? or the other way around?

6
  • you need to create lookup in your custom object so it will display in contact object's related list..
    – Ratan Paul
    Jun 27, 2016 at 7:20
  • The other way won't work? Also, who is the parent?
    – Apex N-u-b
    Jun 27, 2016 at 7:21
  • contact will be parent and your custom object will be child
    – Ratan Paul
    Jun 27, 2016 at 7:22
  • So this would work? contact__r.customobjectfield?
    – Apex N-u-b
    Jun 27, 2016 at 7:23
  • BTW, you answered first so if you make this answer I'll mark is as one.
    – Apex N-u-b
    Jun 27, 2016 at 7:23

1 Answer 1

2

Related list is always of childs. That means that record is related to which all child records.So you need to create lookup in the child or to whose related list you want to show.

In your case it is the custom object.

The object on which you create lookup is always the child.

For more information see Understanding Relationship Names

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.