Daniel Pettet
ServiceNow Employee
ServiceNow Employee

Today I'm promoting FileSync. A NodeJS tool that allows syncing fields from instance records to files on a computer. A technical consultant can then work on the file based record and have those changes published in near real time back to the instance in a seamless fashion.

If you're already hooked on the concept and understand the benefits then click through to the GitHub repository where you can find out more.

https://github.com/dynamicdan/filesync


If you're asking your self why you would want to bother with syncing data back and forth from files to the instance and not use the standard editor interface then read on.

ServiceNow offers basic XHTML and scripting support via a client side plugin that renders extra script formatting buttons and provides basic validation. When compared to a standard development environment this is very basic stuff. A developer should have more tools at their disposal.

Here is a short list of the problems I encountered:

  • no CSS support (or editor support for other types than XHTML and JS)
  • bugs with auto-formatting scripts and no auto-formatting or re-indenting support for XHTML
  • no type-ahead style auto-completion
  • no function overview for quick navigation
  • very basic syntax colouring and no way to extend or change it (eg, for dark/night themes)

This was enough to find an alternative (Adobe Brackets) and I'm glad I did. Using a native app to develop not only solved these gaps in the instance editor but also provided me with enhancements to ensure my script/XHTML/CSS is bullet proof by showing me problems straight away.

The native app developer experience solved the above issues and offered me more:

  • JSHint to detect JS errors and stay inline with best practice JS
  • String matching highlighting which shows me if I've miss-typed something and where I'm using my variables by simply clicking on some text.
  • Easy auto-indent support which shows me if there is an issue with tag matching in XHTML documents
  • Ability to quickly open any record I've already downloaded or worked on
  • Search across multiple records (ever needed to change a class name or say gs.log() to gs.info() for Fuji?)

Once you start taking advantage of even a simple IDE code editor you'll never look back. I'm also extending FileSync to allow SASS CSS pre-compilation and conflict merging via native apps like "FileMerge" (and/or diff command line tools).

Further, FileSync also handles one big missing piece of functionality that the platform doesn't yet support. If more than one person works on the same record there is the potential for an overwrite and loss of data. Even though the version will be saved in the versions list, it will most likely be overlooked as I've seen happen in various projects. FileSync patches this race-condition by first comparing a hash of the record to be updated. If someone else changed the field you are working on before your last sync with the instance then the upload will be aborted and the user warned that they would be overwriting changes. ServiceNow doesn't support this conflict resolution process yet. I intend to extend the FileSync support to provide auto-merging functionality in a future release.

FileSync is open source and waiting for your feedback. Give it a try and if you if you find missing functionality then let me know. Even better, contribute to the growing project and offer a better workflow for everyone!

Comments
ryanlitwiller
Giga Guru

I just have to say this is absolutely awesome! I've just started doing ServiceNow development a couple months ago. I also come from a technical/development background and working within the platform has been so painful. This is exactly what I was looking for! I literally just got it setup and the basic understanding down and with a single command BOW every script I've touched is now in my git tracked repo just listening for updates to push back to ServiceNow! Thank you so much Daniel!



I was curious about update sets, I noticed when it pushes new changes it just uses whatever update set I have set as my current. I'm still a bit fresh to ServiceNow but is there anyway update sets could be selected from FileSync whether its current functionality or a possible future enhancement?


Version history
Last update:
‎05-12-2015 03:02 AM
Updated by: