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:
Thanks.
Best Answer
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)
<-- lookupPaper_Author__c
lookup -->Paper__c
This model supports an
Author
on manyPapers
as well as aPaper
having manyAuthors
. It also will give you the ability to display the related lists perAuthor
and perPaper
which you're interested in by showing thePaper_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 aPaper
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.