Operations | Monitoring | ITSM | DevOps | Cloud

Cookdown

Tricks with the ServiceNow Filter Navigator

The filter navigator sites in the top left modestly heading up the table of options. Until recently I’ve been using it to just filter the list below, then, someone introduced me to a couple of other cool commands you can run. The below six functions are all run against a table, for my examples I’ve uses sys_user, but any table can be used. I was able to find the New York documentation for this functionality here if you’d like more details.

Simple DateTime checks with ServiceNow Script Includes

I can’t remember the exact reason I created this script include, but after finding it figured I’d draft up a couple quick examples as the logic could be expanded to other checks, plus, I might need it again one day so its good to have on hand. The script include detailed below creates a new class type in ServiceNow that can be used both from the client-side with Ajax, and from the server-side as a simple object call.

Getting Related Record Data on ServiceNow Forms

Sometimes a case comes up where you need to lookup further information on the active record, via is referenced records. ServiceNow makes it pretty painless with the g_form.getReference method, which uses a callback to keep from blocking the rest of your script. The example I have below, and on our GitHub repo, uses getReference in a Client Script as a way to notify uses if they are setting the owner of a CI as an inactive user.

Deleting ServiceNow Records via List Filter

When doing testing and development I frequently want to clean up all of the records between releases to give myself a fresh start. Using the list view is helpful, but can be slow if you have more than 100 or so records to delete. The below script is run via the Scripts – Background view to take the results of your list view and delete the records, logging if they are successfully deleted or not with each one.