Skip to main content

ServiceNow - New York Release New Features - Remote Tables

Author by John Hennen

Welcome to the first post in a series on new features in the New York release of ServiceNow, which is slated for GA in the coming months.  In today's post we will talk about Remote Tables.

Remote tables are a new feature that allows you to define a table within ServiceNow and connect it to an external data source.  ServiceNow gets its records from running an associated script against the external data source.  These records live in memory, which means they are purged after you leave the list/form.  Optionally, you can define a cache TTL to cache the data in memory for a set period of time.  

Sounds great - let's see an example!  I will be creating a table and script to pull in weather data for the city of Milwaukee from OpenWeatherMap.

First, let's ensure we have the plugin enabled:

ServiceNow Remote Tables Plugin

Second, let's create our remote table definition!  Browse to System Definition -> Remote Tables -> Tables and click New.  This form likely looks familiar to you - it is the usual create table form you know and love.  The only difference is that the "Remote Table" box is checked.  Create the columns you need for the data you expect to get back from the external source.  Here is what I did:

ServiceNow Remote Tables Weather Table

Next is the interesting part - creating the script to query the external source and populate your table.  Browse to System Definition -> Remote Tables -> Definitions and click New.  Here you are presented with a simple interface and left to your own devices to write a script that will do what you need it to do.  Luckily, if you have worked within ServiceNow for awhile you are probably familiar with many of these techniques.  I wrote a very simple script with no error handling or other such logic for this post - feel free to use it as a jumping off point!

ServiceNow Remote Tables Weather Script

A few things to point out here:

  • You have to generate a sys_id, which I do using the gs.generateGUID() function
  • As you are writing this script yourself you can pretty much do whatever you want - which means there is the possibility/probability of writing something that will not perform as you would like.
  • You can also define the cache TTL on this form, if you like

The end result?  When I view the list of my remote table I see:

ServiceNow Remote Tables Weather List

And there you have it!  A working example on how to use remote tables to pull in data from an external source and have it presented as a table within ServiceNow.

One last note - ServiceNow's official documentation page does a pretty good job of explaining the how and why of this new feature, so take a moment and check it out: Link

Stay tuned for the next blog post where we will look at more exciting new features in the New York release!



John Hennen

Managing Architect

Tags in this Article