function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anup Kabra 2Anup Kabra 2 

Need advice on creating many to many relationship on Accounts

Hi All, I have a requirement where I need to create many to many relationship between Accounts. I know this can be achieved by using Junction or Intermediate object but I don't want two related list to show up on Account detail page.

For example: If Account A is related to Account B and Account C, Detail page of Account A should have one related list showing details of Account B and Account C. Similarly, Account B and C should have details of Account A on it detail page.

I tried using Intermediate object with two lookups for account but it returns two related list on account detail page but I need only one. 

Is there any way we can achieve this. Also, are there any apps on appexchange which can perform this task?
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Anup Kabra,

May I suggest you please check the below link for reference. Hope it helps.

Please mark it as best answer if the information is informative.

Thanks
Rahul Kumar
Suraj TripathiSuraj Tripathi

Hi Anup,

Yes, your requirement can be by using Junction or Intermediate object.

If you don't want two related lists to show up on Account detail page for this you can change the layout form the Object.

Open the Record in the object in classic -> Click on the Arrow on the Right Side -> Edit Layout -> and remove that List from related List.

Screenshot : 

User-added image

Hope it Helps you. Please mark this as solved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Regards ,
Suraj

Anup Kabra 2Anup Kabra 2
@Suraj Tripathi, Hi Suraj, If I remove one of the related list from layout, it will be same for all account detail page and that will not give me proper data. Please find screenprint below:

Creating relationship between TestAcc1 and TestAcc4 using Junction object:
User-added image
If I go to detail page of TestAcc1, I should see details of TestAcc4 in the related list:
User-added image
Similary for TestAcc4 details page should show TestAcc1 in the related list:
User-added image

Now if I remove, one of the related list from page layout, I won't be able to see the details in the other account details page. I hope I was clear.