Notes from working for Service Now

I've been working for Service Now since Labor day of 2012. I've had to do things to the poor platform it was never intended to allow.
So, here's some of them. Maybe you'll find 'em useful.

Killing long running processes

Go to https://<my_instance_url>/ will cancel any script and DB queries associated with your current session.

Removing a Script Include from the current context

My usage:

//re-include qunit to allow for multiple runs
    CidQUnit2.log("could not remove QUnitLoader")

QUnitLoader creates a global exports object, to allow QUnit to include itself on, then copies exports.QUnit to the global namespace. This code removes the names from the record the system keeps of already included scripts (keeps from re-including scripts that have already been used).
Then it removes the global references the scripts create.
If you are using standard SNC Script includes, then it becomes a bit easier:

Logging tricks
  • gs.print() will log only to your session,(activate System Diagnostics -> Debug Log) gs.log() will log to your session, as well as system logs.
    Problem with gs.print is that it always prefixes the output with *** Script:. If you don't want this, use GlideLog.print()

  •'QUnit', message); //same as gs.log()

  •'QUnit: ' + message); //same as gs.print(), but without that *** Script: prefix