6

I am quite new to Salesforce and have not yet any thing like the following.

We have a Paper object which is looking up for authors in Contact object. We want to create to have custom related list of all papers for each of the authors. In other words, when an author is viewed from Contact tab, we want to have a list of his publications in the custom related list. Each paper can have up to 10 authors. If it has 10 authors, the paper should appear in each author's page in custom related list.

Is there any way to create without apex/trigger coding ? (if I need to code, how to create related list from apex? )

Here is our Paper object:

enter image description here

Thanks.

2 Answers 2

6

This is a many to many object model which will utilize a 'junction object'. Employing a pair of lookups defined on the junction object with a structure that looks like this:

Author (Contact) <-- lookup Paper_Author__c lookup --> Paper__c

This model supports an Author on many Papers as well as a Paper having many Authors. It also will give you the ability to display the related lists per Author and per Paper which you're interested in by showing the Paper_Author__c list in each case.

You state that it is 'up to 10' Authors on a paper and I would highly recommend against you defining the object model with Author 1, Author 2, Author 3 etc. This is going to be a painful thing to overcome in the future when the '10 author' model doesn't work any longer.

The many to many model using the junction object, is the proper implementation of this concept, allows for an 'unlimited' number of Authors on a Paper and is 100% future-proof.

Additionally, the Author 1, Author 2, Author 3 lookup field model will not allow you to display a related list of Papers an Author has contributed to.

The junction object is the correct approach in all cases.

4
  • Thanks Mark. So, in other words, are you recommending to create a junction object, which will only appear in relevant related lists of Paper and Contact? And, instead of having authors as lookup fields to Contact, should I use related list to Paper_Author__c on Paper to register authors ? Thanks.
    – vlr
    Commented Nov 5, 2013 at 21:21
  • Yes, that is absolutely correct.
    – Mark Pond
    Commented Nov 5, 2013 at 21:27
  • You are very welcome.
    – Mark Pond
    Commented Nov 5, 2013 at 21:31
  • It worked nice, until I received additional requirement to allow to user to manage order of authors' related list. Basically, the order is important in academic papers. If you can advise on this too, I posted a separate question here : salesforce.stackexchange.com/questions/19402/… . Thanks
    – vlr
    Commented Nov 8, 2013 at 9:16
0

There are some good pointers how to create junction object:

https://help.salesforce.com/apex/HTViewHelpDoc?id=relationships_manytomany.htm&language=en

You must log in to answer this question.

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