Service-Now JavaScript Library Resource

Something that is missing when you get started with Service-Now development: a package of tools to make a developer’s life easier. A good part of the reasoning behind this, is that Service-Now intends for you to do all development directly in your development instance. They’ve provided some great functionality around this (syntax highlighting and basic error checking). However, there’s no code completion, and if your web browser happens to crash, you’ve just lost your past 10 minutes of work.

For the inaugural post on this Bite-Sized Blog, I’d like to share something that I’ve put together, and use on a daily basis. It’s a library of Service-Now JavaScript files to help with auto-completion in your favorite IDE (it works great in Netbeans and Webstorm).

This allows you to easily see what functions are in a GlideRecord or GlideSession object, etc. Extremely useful for learning about new functionality, as well as programming more complex Service-Now scripts.

There may be something like this already out there, but not to my knowledge. These are not official files, but rather a compilation of information found in the Wiki, Forums, through Firebug, and just perusing the scripts in the instance.

I’ve attached all the files I have, as well as instructions for setting up the auto-complete in Netbeans if that happens to be your preferred IDE.

If anyone has anything to add to this, or has a better/more complete library, let me know!

Service-Now JavaScript Library

Setup Instructions for Various IDEs

WebStorm/PyCharm

  1. Install WebStorm/PyCharm (obviously).
  2. Extract the archive and place the “Library” folder within your project.
  3. Give time for the indexing to complete.
  4. Done!

Old Versions of Netbeans

  1. Install Netbeans and set up a project for your Service-Now work.
  2. Extract the archive and place the “Library” folder within your project.
  3. Go to File -> Project Properties.
  4. Click on PHP Include Path.
  5. Click Add Folder.
  6. Navigate to the Library folder and add it as an include path.
  7. Restart Netbeans.


Categories: Developers, Development Tools

Tags: , , , , ,

16 replies

  1. Thanks for sharing this .. Will try this out today 🙂

    Like

  2. Thanks for sharing….
    I have installed NetBeans latest version, while creating New project I couldn’t found category for JavaScript.
    Could please elaborate the process you have followed.

    Like

  3. Thank you very much…. Please help remove my ignorance. How do you make this work with WebStorm?

    Liked by 1 person

    • Hey Jason! Great question. For my PyCharm setup (essentially the exact same program), all I had to do was include the “Library” folder somewhere within my project. It then took some time to index, but once it did code completion worked great. Let me know if this method doesn’t work out for you, and I’ll do some more digging.

      Like

  4. Hi, in net beans for methods documentation is not showing..

    any suggestion please..

    Like

  5. Could you please send your mail Id I will send you screenshot. I am getting suggestions for methods but I am not getting related documentation for it. Is there is any way to get documentation.

    Like

  6. This is very cool. I would like for my team to assist with expanding the functionality .. but will first have to learn how to make it work in this format.

    Like

  7. @Jason : In NetBeans 8.02 I have seen this functionality for other libraries and even for html tags. I am trying to figure out how this work for other libraries, if we manage to find this then we can add that script to original script of grgisme.

    I have raised a ticket with Netbeans for this, @Jason Please update me if you found any solution @ shferoz1@gmail.com

    Like

    • I was able to. Figure it out, I will send you a how to on Monday.

      I want to expand the library to include the other stuff that is used in SNow

      Like

      • Thanks for taking the time to figure it out Jason! Be sure to let me know, and I’ll put the instructions in the post and credit you for it.

        I’d love to get a git/bitbucket created for this so that everyone can help contribute to it, and we can have a community supported growing library.

        If we were to do that, we could also then build in a community open repository of custom ServiceNow functions that solve common issues (date validation on client side, etc.).

        My time is often limited, but I want to help make this happen.

        Like

      • Thanks jason for taking time to figure out. I have done this by using html tags for each method in JS comments.

        I am eagerly waiting for your solution. Then we can opt the easiest way of doing this.

        Like

      • To make it work in Netbeans 8.0.2 this is easily accomplished. Go to Tools -> Options -> PHP tab -> In the “Global Include Path” Section , Choose “Add Folder” button and then add in your LIB.

        save … done..

        Like

  8. Awesome work! Thank you very much!

    Like

  9. Has anyone implemented this in Eclipse IDE?

    Like

    • Hi,
      In eclipse (Mars) right click on your javascript project select properties, then JavaScript-> Include Path. Click on AddJavaScript Library-> user library-> configure user libraries -> new. Enter a name for the library like ServiceNow click okay. Click add folder and browse to where you have extract the servicenow library and select it.
      Also is this the latest version of the ServiceNow library, there seems to be a few missing methods, classes?

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: