Unfortunately, as of the Geneva release with UI16, ServiceNow has made the decision to discontinue the ‘HTML (From Arguments)’ module type that this solution depends on. As such, Module Counts won’t work anymore and I’m forced (for the time being) to take the solution down. If this is a functionality you would like to see, the best current option is to flood SN with as many enhancement requests as we can to get them to add the behavior to the system.

To date, this solution has been downloaded almost 2,000 times and is in use in hundreds of ServiceNow systems. Hopefully ServiceNow will find a way to listen to their customers and include a similar behavior in the near future.

One common request I’ve heard a lot from customers and on the ServiceNow forums is to add the ability to present list modules in the left navigation pane along with a count of records from the corresponding list query. This functionality is something that we’re all pretty familiar with since it’s a standard part of most email clients (including Microsoft Outlook and Entourage).

A few months ago I (along with a few other people) worked on a bit of code that brought this functionality to ServiceNow. While it was a cool idea and it seemed to work okay at first glance, the solution was very performance-intensive and pretty buggy. Slow page load times, left navigation hanging, and other issues were a frequent occurrence. As a result, if anybody asked me about the solution I told them not to use it. I just had another request for this the other day and thought I’d take another crack at a solution. After several hours of work and a fair amount of testing I’ve come up with the Outlook-style Module Counts update set.


This customization includes the following features:

  • Display the record count for any list module
  • Completely code-free configuration
  • Asynchronous AJAX means that you won’t have your left nav hang while your module waits for the query to return
  • Per-module count coloring
  • Per-module refresh interval. Refresh counts as often as needed for each module.
  • Optional sort order field to sort results
  • Optional ‘Count filter’ for counts independent of the module definition filter

Core components:

This solution really just requires a few key components. The bulk of the heavy lifting is done by a business rule on the ‘sys_app_module’ table called ‘Populate Counts Arguments’. The whole purpose of this business rule is to keep you from having to modify code. It runs before an insert or update of a Module record and populates the necessary HTML arguments to generate the module. The arguments contain all of the information about the table, filter, image, etc.

The second core piece is the ‘ModuleCount’ Script Include. The script include is called from the module arguments to execute a given query and return the result (number of records) back to the module for display.

Finally, there are a few new fields and a couple of UI policies to keep the UI from getting too messy :).

Usage:

This customization is only offered as an update set through ServiceNowGuru. You’ll need to install an update set into your instance to get this functionality. Installation and download instructions can be found below.

So easy, a caveman can do it! I’ve designed this solution to be a completely code-free experience for anyone who uses it. The first step is to select ‘HTML (from arguments)’ as the module link type and check the ‘Show count’ checkbox. Once you’ve done that a UI Policy takes over and shows you all of the fields necessary to create your counts module. Simply create or modify your module just like you would with any regular list module and add the optional parameters as shown in the diagram below.