Screenshot_9_18_15__4_50_AM

A few weeks ago, I shared a spectacular week with my new team in Hyderabad, India. We shared a fun-filled week geeking out on integration and application development on the ServiceNow platform. These folks are going to have a lot of fun with the types of projects coming our way.

Within the next few months the world will see how the built-in ServiceNow editors have continued to get more and more functional and feature rich (oooh….can’t wait for that Geneva release!). However, some people continue to use traditional native text editors for typing their code. After spending time with my teams both in the US and in India, I continued to see a large amount of copy-paste action happening from text editors into the ServiceNow browser windows, I decided that I needed to resurrect my 7 year old Python skills and update the ever-useful ServiceNow plugin for the Sublime Text editor which was original written by some talented friends at Fruition Partners (Original Sublime Text Plugin). I actually wrote about this plugin last year in “Using the SublimeEditor to write ServiceNow code“, but decided that it needed a little updating.

I have forked the original Fruition version of the plugin and have created a version that has the following enhancements:

Support for Sublime Text 3
One of the first things people ask me when I have tried to introduce the ServiceNow plugin for Sublime is whether it works with Sublime 3. I have always had to tell them that unfortunately they would be sticking with Sublime Text 2 if they wanted to use the plugin. Well, no more! The ServcieNow plugging or Sublime now works on both Sublime 2 as well as Sublime 3.

Enhanced Messaging to the End User
In the past, if there was a connection or other error during the sync process, an error would get output to the log behind the scenes, but the end user would have no clue that their changes were never uploaded to the server. I have added modal dialog boxes that will notify the user when there are such errors and provide some basic text around the error. More detailed text can be found in the behind-the-scenes debug log still as well. This will provide better user confidence in their use of the plugin.

Conflict Detection
This feature is the one I am most excited about as it fixes one of the biggest impediments for me in using this plugin in a team environment. In the past, if people were to change the source within the ServiceNow instance between the times when I was saving my version within the sublime editor, their changes would be overwritten by my copy. I have enhanced the plugin such that it will pull the current instance version of the data and do a conflict detection routine before it tries to update the server. If there appears to be a mismatch of any kind, the save action will be aborted and the user will be notified that they need to resolve the differences between the instance version of the data and their own. This should help prevent Sublime users from inadvertently overwriting important changes that are done within the instance on the same record.

To get the newest version of this plugin, please visit: Enhanced Sublime Text Plugin for ServiceNow

Instructions

The instructions for using this plugin are the same as the original plugin. At the top of the record text in Sublime, add a comment section to indicate where the text will be saved. Your comment block will contain three parameters:

  • __fileURL – This is the full direct URL to the record. Don’t use the url that leverages “nav_to.do”. Use only the direct URL.
  • __fieldName – This is the field that will contain the text you save in your editor. It is the database name for the field, not the label of the field
  • __authentication – This is your credentials for that instance in this format: username:password. After the save, the text will be replaced with “STORED”.

A couple of examples of your Sublime Text Comment Block Include:

XML / HTML Fields

1
2
3
4
5
<!--
// __fileURL = https://myinstance.service-now.com/sys_ui_page.do?sys_id=2d8dcb5e6f2d060009125ee44b3ee4b9
// __fieldName = html
// __authentication = STORED
-->

Javascript Fields

1
2
3
// __fileURL = https://myinstance.service-now.com/sys_ui_page.do?sys_id=2d8dcb5e6f2d060009125ee44b3ee4b9
// __fieldName = html
// __authentication = STORED

Video


Updated Sublime Text 3 Plugin for ServiceNow

Get the Plugin