ServiceNow JavaScript API Libraries

This ServiceNow JavaScript API library was adapted from something that Garrett Griffin put together in 2014. I found the libraries so useful, that I decided to build upon, add to, and update them throughout the last several years (with permission from Garrett) in order to make developing ServiceNow-centric code in my local IDE a lot easier. While I've done a lot of work on this over the last few years, most of the credit must surely go to Garrett for his hard work in starting this out. Thanks, Garrett!

Follow me on Twitter (@TheTimWoodruff) to get notified of major updates to the libraries, so you’ll know when to pull down the updates!

Github repo

Adding Libraries


The IDE that I use is Jetbrains Webstorm, which makes this whole process a lot easier. To add a custom library in Webstorm, make sure you’ve pulled down the git repo and know where it’s located. Once that’s done, go to File > Settings > Languages & Frameworks > JavaScript > Libraries, then click Add.

In the Add dialog, enter a name like “sn-js-lib”, then click the “+” icon to the right, click “Attach directories”, select the folder you downloaded the libraries to, and click OK a couple of times, then you’re all set!

Usage Tips

//work-in-progress: Need to add keyboard shortcuts in various IDEs and general usability info

Undocumented APIs

It’s important to be aware that the mechanism I used to pull in a lot of these APIs, exposed undocumented APIs as well. Use these APIs at your own risk. If you don’t understand how an API works, don’t use it. Look up the API docs before using an unknown API.