logo

NJP

Create a Custom Related List in ServiceNow

Import · Dec 21, 2023 · article

There are a few ways to create a custom-related list

But first of all, let's clarify what related lists are.

Related lists in SN are these:

Related list: Defined related lists provide a list of any records you want at the bottom of the form.

For example, a simply defined related list that lists other rooms on the same floor may be placed on the Room form. This helps you quickly navigate between them.

For more explanation & other examples have a look at this article.

Key takeaway:

This functionality depends on reference fields or many-to-many table relationships. If two tables are related via the system dictionary, one can appear as a related list on the other.

Best practice:

Before creating a related list or relationship, verify that there is not an existing relationship record that already provides the needed information.

Steps

  • Navigate > System Definition -- Relationships
  • Click New
  • Specify the relationship record fields
  • Click Submit

Applies to table: on which table you want to see the related list

Queries from table: from which table you want to show the data

current: queries from table

parent: applies to table

Script:

Navigate > Change requests

Add the related list to the change form via the context menu > Configure > Related List:

In the change form of any change request you should now see the Incident by Requester Related List:

Note:

This method assumes that there is already a relationship between the two tables (applies to table & queries from table).

Second method

Now, imagine that you don't have a relationship between the tables that you'd like to have a related list.

For instance, you want to populate a related list on a custom table (let's call it - Credit Bucket) that queries the task time worked table.

What to do then?

Easy.

Create a reference field on the task time worked table and refer it to the custom table:

Congrats!

You have just created a relationship between those two tables.

On the custom table, you can now populate the related list via the context menu > Configure > Related List:

How cool is that?!

Note:

Via this route, you don't have much control over which data to query specifically like with the first method.

Note:

The same principles apply to custom-scoped apps!

Note:

How to identify who modified the related list configuration?

Answer:

A quick fix to rollback the modified default view:

Import the default related list from a different instance (i.e., Hotfix) into the current one.

Thanks for reading and till next time!

Source:

View original source

https://www.dancovic.com/2023/12/create-custom-related-list-in-servicenow.html