How to add a custom related list for a table that has a many-many relationship with the secondary table

Robert Hames
Giga Expert
I have two tables with a many to many relationship. Records in the first table can appear multiple times in the second table, and records in the second table can appear multiple times in the first table. I created a bridge table that has it's own unique key, and then two reference fields that point to the sys_id in the two tables. What I need to do is have a tab at the bottom of the first table's form that shows any records that have been added for the first table's sys_id to the second table. I am able to show the intermediate table at the bottom of my first form, but I need to show the name from the second table. Is a bridge table the way to accomplish this, and if so, how can I have the values from the second table appear in the section at the bottom of my first table's form?
Show less
 
 
 
 
2 REPLIES 2

Jeff Hammond
Kilo Expert

If I understand everything this should work. I'm guessing you have your Bridge Table (aka Many To Many/m2m) in the related list? If so you can modify the list view and add fields from the 2nd table.

If you click on the "hamburger" menu in your related list on one of the columns, there is an option there to configure list layout:

 

find_real_file.png

 

From there you can dot.walk to your fields on the second table. Give a yell if this isn't what you needed or need more details.

Robert Hames
Giga Expert

Since I posted my original question, I have discovered m2m tables and now have it setup that way. But your illustration shows it working in the Studio while I need this to work on a portal page, which I mentioned in my original question. I have made the necessary changes in Studio, and it works on a form. But, since my application requirement is to do this in a portal, I need to figure out how to do that.

So, I guess my real question is how do I add a m2m widget to a portal page? I've tried using the various data widgets, but they don't allow for adding or deleting entries.

Is there a widget that allows me to add the m2m table to a portal page, and be able to add/delete entries?