Unable to find relationship of relate list

Sachin G K1
Kilo Sage

Hi All,

I added on Related list "Outage" for incident as you can see in below picture, but i am unable to find relationship of this related, I really want to know how this related list working, and how it is created.

SachinGK1_0-1705213642420.png

 

SachinGK1_1-1705213664019.png

Thanks,

Sachin

9 REPLIES 9

Hi Arpan,

Thanks for giving info.

But i am curious to know how that related list actually created. Suppose i want to create one relatedlist in incident table. Which actual look for record in table "X" with incident number .

How to configure this. How to create that related list.

Well, for that, you could go to the Relationship table [sys_relationship] table and create a related list. If you haven't configured one before, you would see that there are two objects that are used in the 'Query with' script - current and parent.

 

Keep in mind that the current object is associated with the "Queries from" table while the parent object is associated with the "Applies to" table. That should help you write the GlideRecord queries as per your requirement. 

 

However, before you actually go ahead and create a relationship, do check among the available related lists if there is one that can fulfill your requirement. This good practice will save you time and effort.

Hi Arpan,

I known we can do that using relationship, but i am curious to create related list without related list, just like outage in incident table. Hope your getting my point

-O-
Kilo Patron
Kilo Patron

There are two types of relationships in ServiceNow:

- manually created ones, which meany people here talk about, the ones created using the Relationships module and

- automatically existing ones.

 

The automatic related tables result from reference fields.

 

Say let's say you have 3 (just for the sake of this example, but you can have any number of tables, or even just one) tables:

- Table A,

- Table B and

- Table C

and both Table A and Table B have a reference field called Table C that refer to Table C.

In that case Table C will automatically get two possible related lists: Table As and Table Bs.

When adding related lists for form Table C, you will find entries

Table A->Table A

Table B->Table B.

 

To make less abstract, lets take table Company (core_company), User (sys_user) and Task (task).

Both User and Task contain a reference field called Company (company) that refer to table Company (core_company).

Therefore form Company (core_company) automatically "receives" two related lists: Users and Tasks.

In the list of possible related lists you will fined entries:

Task->Company

User->Company

which show which table through which reference you would be relating.

Actually you will also find a possible related list as

Company->Parent

because company has a reference field called Parent which is a reference to itself.

Of course the list of possible related list will be much larger, actually huge, because many tables have references to table Company (core_company).

 

Also these are not stored anywhere, these will be created on-the-fly when the related list part of the for is edited.

Configured related lists are stored in table sys_ui_related_list.

But not the available related lists.

 

There are also "special" automatically created related list, the ones that point to many-to-many tables, registered in tables sys_m2m and/or sys_collection which govern how the New and Edit... UI Actions behave on related lists and allow ordering related lists.

E.g. when you press the New button on the Groups related list on form User, where the tables Group and User are related by an m2m table Group Member (sys_user_grmember), for this to work, two records have to be created: a new Group (sys_user_group) record and a new Group Member sys_user_grmember record.

Because there are entries for this relationship in sys_collection, when one presses the New UI Action on the Groups related list (on form User), the system takes the person doing this not to the directly related many-to-many table Group Member (sys_user_grmember), but to the Group (sys_user_group) record.

If the new Group (sys_user_group) record is saved, the system will know to automatically add a Group Member record too (sys_user_grmember).

Here's how the many-to-many table linking Group and User (or User and Group) is "configured" in Sys Collection (sys_collection😞

12.png

 

But all those still are not really definitions of related list, but rather how would possible automatic relationships - once added to a form - behave.

-O-
Kilo Patron
Kilo Patron

Oh, and to answer the original question explicitly, you can add that related list because table Outage (cmdb_ci_outage) contains reference field Task number (task_number) which refers to table Task (task).

Here we can see the effect of an additional rule that applies to related lists: a table extending another table inherits the related lists of the table being extended.

Thus - in this case - Incident (incident) inherits Task (task)'s Outages related list.