Need advice on creating one to many relationship between two custom tables

AmritaT
Tera Expert

I have created two custom tables tab A and Tab B. I can create records on Tab B from Tab A. 

e.g creating problems from inc table.

As per the document, I have created a m2m relationship -

Step 1 -

find_real_file.png

Step 2 - Add the related list to the table -

find_real_file.png

Step 3 - ??   I'm not sure what else to do to add the list of records to be seen under this related list.

 

E.g - I want to be able to see the contracts under the addenda as given below in the screenshot for incident and problem -

find_real_file.png

Please advice. Thank you.

 

 

 

1 ACCEPTED SOLUTION

ggg
Giga Guru

if table A is the parent and table B is the child

create a field on table B of type "reference" and select Table A as the reference table.

Then go to table A, right click at the top of the form, select Configure >> Related Lists >> select your related list.

The child records appear at the bottom of the form.

View solution in original post

11 REPLIES 11

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

you have to add the related list in both tables (From table and To table defined in the sys_m2m.list), then go the related list and right click one of the columns and Configure > List control and click Enable edit and uncheck the flag Omit new.

Now you should be able to add or edit a related list and see them populated as per the relationship defined.

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thank you

Cheers
Alberto

Thanks Alberto for the quick response.

I did try the above steps, however, I'm able to get the list on the contract table but not on addenda -

find_real_file.png

find_real_file.png

Sorry I didn't read well your requirement, for the relationship ONE to MANY, there is no need to create a record in the sys_m2m table but you simply need to create a new reference field in the “target” table (B) and then add the new Related list available and move it from “Available” to “Selected” in the "source" table (A).

Give a try and let me know.

Cheers

Alberto

Tried that too -

find_real_file.png

It is blank. Doesn't auto populate when I create record from tab A to Tab B 😞