Mwatkins
ServiceNow Employee
ServiceNow Employee

Next Article >
Performance Hacks: Reference Fields (2 of 4) Autocomplete Wait Time


ServiceNow Reference Field

find_real_file.png@MWatkinsSNow

What a wonderful tool! What a multi-faceted, powerful, customizable, many-splendored thing!! But it can be SOOOOO slow!

There's probably a whole book of things that could be written about this topic. In fact, I think I'll start a mini-blog. So, without further ado, here is article #1 of 4:


The Problem

You go to fill in a reference field. You don't know the exact name of the item your looking for, so you click the magnifying glass icon to lookup your answer using a list...

find_real_file.png

And you wait...

And you wait...

And you wait.

In the background what is happening is that ServiceNow is running a COUNT(*) query to pull back the total count of all records in the table that the field is referencing. MySQL/MariaDB is not very good at that sort of thing. If you have over 1 million records in your table you will probably start to have noticeable latency. The latency should scale upwards in linear fashion.

TL;DR The more records in a table, the longer it will take to count them all.

To demonstrate this I created a simple 4 column table and inserted 10,000 records at a time, recording the response time to count the number of records in the table after each 10,000 records. As you can see, there is a linear relation between table size and response time.

find_real_file.png

 


The One Solution

Don't count them. Seriously. Who really cares how many records match your list filter when you are only going to select one matching record? Reference fields only allow one value to be selected, so what good does the total pagination count do? Ditch it and be free!!

1. Open yourinstance.service-now.com/my_table_name_list.do

2. Right + click the header and select "Configure > List Control"

3. Right + click the header of that form and select "Configure > Form Layout"

4. Add the three fields shown below, click "Save" to save your changes to the Form Layout.

5. Now, from the List Control form, fill in the field values as shown below to the List Control form.

find_real_file.png

5. Now the popup list won't run the COUNT(*) query but all the other lists for that table will still display pagination and it will be SUPER FAST!

find_real_file.png

 

Next Article >
Performance Hacks: Reference Fields (2 of 4) Autocomplete Wait Time

Additional References

  • Orlando List Improvement Remove Pagination Count - KB0817996
Comments
kevinmiles
ServiceNow Employee
ServiceNow Employee

There are a few special cases, such as the lists that are displayed when you click on the "Add" button in the "Affected CIs" and "Impacted Services/CIs" related lists on the Change Request form.  These buttons actually open a model form that displays a list. 

 

1) Add Affected CIs

To change this behavior for the list shown when you click on the "Add" button for the "Affected CIs" related list on a change request form, you will want to edit the list control for the "Calculated Application Services" [cmdb_ci_service_calculated] table and disable the pagination for the "associate_ci" view. There is no "associate_ci" view out-of-the-box, so you will need to create one:

a) Navigate to /cmdb_ci_service_calculated_list.do
b) Right-click on one of the column headers and select Configure > List Layout.
c) Under the "List view" section, change the "View name" to "New..."
d) In the "Create New View" modal, enter View name: associate_ci
e) Click on the OK button.
f) Optionally, adjust the fields as needed.
f) Click on the Save button.
g) Right-click on one of the column headers and select Configure > List Control.
h) Enter the following information:

Remove pagination count: True
Remove pagination count for specific views: True
Specific list of views prevented from getting full record count: Associate

i) Click on the "Submit" button.

You can test this out by navigating to the /change_request_list.do list, opening a change, and in the "Affected CIs" related list, click on the "Add" button. You should see the modal form open and the list render, but without pagination.

 

2) Add Impacted Services/CIs

To change this behavior for the list shown when you click on the "Add" button for the "Impacted Services/CIs" related list on a task_cmdb_ci_service form, you will want to edit the list control for the "Configuration Items" [cmdb_ci] table and disable the pagination for the "associate_ci" view. There is no "associate_ci" view out-of-the-box, so you will need to create one.

You can follow the same instructions as above, but in step a), you will want to instead navigate to /cmdb_ci_list.do instead.

 
Version history
Last update:
‎06-11-2021 02:10 PM
Updated by: