Skip to main content

Posts

A little rant about Rhino 1.7R5 (the "new" Javascript Engine in Service Now)

Since the release of Helsinki, the Service Now Documentation contains this text: (Screenshot of the Madrid Documentation ) This sounds as if Rhino 1.7R5 was something fancy and new. In fact, Rhino 1.7R5 was released in January 2015. At the time of this writing, this was exactly four years and three months ago . This is not exactly what I would run under the label "Javascript Engine Update". Especially if you consider that Rhino is the very interface you are programming against in your daily life as a Service Now programmer. Of course, you can also add Java Code, but this is rather rare. Also the statement "You can use modern library code.." is cool - because you will not be able to leverage any post 2016 Javascript features. This starts with very basic things like the  missing let keyword, but also means that there are no promises and other advanced features available. Also from a security point of view I think it's not justifiable to use such an old l...
Recent posts

How to find a Workflow context?

All Service Now Workflows run on one specific record of a table specified when the Workflow is created. Note that there is one Special Table called "Global" that can be used when a single Workflow should be used for more than one table. Each execution of a Workflow is called a "context" and is linked to one specific record, lets say of the sc_req_item table (for Service Request Management). In General, when looking for anything in Service Now, I recommend a look at the data dictionary. When checking "Tables" (just enter sys_db_object.list in the Filter Navigator and hit enter), you see that there are a couple of tables with the prefix wf_ (this is a funny thing in Service Now: the naming convention for tables are not consistent at all. I think one of the reasons is that the system does not allow renaming tables. This would be a cool Feature, but it would require proper refactoring support in the codebase). Anyway, the table you need to look at is...

How to write JavaScript code efficiently in Service Now

Let's face it: the code editor of Service Now is ... suboptimal. While it offers basic Features like Syntax checking and (minimal) expansion, developers used to modern IDEs like Visual Studio are quickly underhelmed. For me, the most frustrating issue is that every time I save that large script include, I find myself again in the first line, rather than in the one I was just editing. It is infuriating! Also, it completely lacks Features for refactoring code, leaving only good old "Search and Replace" as an option. My editor of choice is Sublime Text , because it has some very powerful Features to offer: It is fast Multi-Select and Edit Decent Code expansion (without the Service Now specific dot-expansion) Automatic Documentation via  DoxyDoxygen A very powerful  Snippet System (Basic) Refactoring via  Javascript Refactor It's clear that this does not solve all Problems, because for example refactoring only takes the current file into account. If Service N...