Embedded list - getting created while creating m2m records

Anish Reghu
Kilo Sage
Kilo Sage

Dear experts,

Relationships:
Adding a Reference field on table A that points to table B, creates a relationship that ServiceNow can understand. This allows you to add a related list of records in table B, that displays the records from table A that are linked to it.

M2M table: Creating a M2M table via the sys_m2m relationship definition table also creates a relationship that ServiceNow can understand. Because of this, you can add a related list on either of the two tables linked by the relationship, to show related records from the other table.

Embedded list: When Table B has a reference to Table A, then on the form layout of Table A, Table B can be selected as an embedded list.

Given the above understanding, I have the following scenario and outcome. Help me understand please why this happens.

There are two custom tables created - u_table1 and u_table2.

When I define a M2M relationship between the two - 

From: u_table1

To: u_table2

Question1: I fail to understand on what basis are the fields getting auto filled on m2m relationship. Is it on the basis of Display value. I checked that it gets auto-populated even for tables where no fields are set as Display value = true.

Getting back to the scenario - the m2m relationship being created, allows me to add u_table2 to be added as a embedded list on u_table1 and vice-versa.

Question 2: How is this possible?

That defeats the understanding that creating a m2m relationship allows one table to be a related list on the other, not as an embedded list. Embedded list is only possible when there is a reference field. But here none of the table is being referenced on the other table. Since, both tables are custom, there is no chance that either of these tables are referenced anywhere on the ServiceNow applications. How doe this still become possible?

 

Question 3: Check the below snapshot.

find_real_file.png

These are all embedded lists on the incident table, just picked the first few listed there.

There are A-->B (which are related lists) entries and entries like "Affected Locations" (Reference fields). So, does it mean every related list can be defined as an embedded list as well?

 

Question 4: What does the module Related list contain? Is every related list of all application tables stored here?

 

Best Regards,

Anish

1 ACCEPTED SOLUTION

Aman Kumar S
Kilo Patron

I will try to answer your questions to the best of my knowledge:

A1 - Display value doesn't work only if you set the display value for a specific table.

Reference fields look for the display value in the following order:

  1. A field with display=true in the system dictionary on the lowest sub-table for extended tables.
  2. A field with display=true in the system dictionary on the parent table.
  3. A field named name or u_name.
  4. The Created on field of the referenced record.

 

A2 - Below articles should help:

https://community.servicenow.com/community?id=community_question&sys_id=fc15d5eb1bdce410305fea89bd4bcb8d

https://community.servicenow.com/community?id=community_question&sys_id=a271a035db665380200f0b55ca9619aa

A3 - So, does it mean every related list can be defined as an embedded list as well?  ---- YES

 

A4 - What does the module Related list contain? Is every related list of all application tables stored here? ----YES

For custom ones, you have "Relationship" module as well

Best Regards
Aman Kumar

View solution in original post

6 REPLIES 6

Anish Reghu
Kilo Sage
Kilo Sage

One more interesting thing observed is that When Table_A references Table_B, the embedded list entry on Table B reads in the following format:

Table_A --> Reference_fieldLabel_on_Table_A

E.g. Incident --> Assigned to on the User (referenced) table.

 

Cheers,

Anish

Anish Reghu
Kilo Sage
Kilo Sage

Got some more info on this topic and thought could share here for anyone else's future reference before I close the thread:

All related lists by default will be available for selection as an embedded list as well.

It is because we selected that embedded list to be made available on the form that we see it.
 
If I create a scoped application and two custom tables in it, creating a m2m relationship puts a new entry of the newly created m2m relationship on both the Form layout configuration (in Available section).
 
Why do I see only the M2M created entry as an embedded list and nothing more than Attachments? This is different than the long list of embedded lists seen at the bottom of Available section on tables like Incident, etc.
 
Because you have defined the table in the scoped application and remember yours is a custom table which is not referenced anywhere else in ServiceNow.
A Many to many relationship between A and B = Relationship from A-->B + Relationship from B-->A.
 
For every relationship created, there is only one related list made available on the 'Applies on table'.
 
But every m2m created is creating the same entry duplicated as two related lists performing two different functions (A->B and B-->A). 
 
Cheers,
Anish