Using Java on the MID server

One exciting capability of the MID server is that it lets you run Java commands. Just like the instance, the MID server uses Rhino, a JavaScript interpreter written in Java, to execute your scripts. We've just been using this via JavascriptProbe.

However, you may want to do things that JavaScript just can't provide. So Rhino also gives you access to the Java API and other libraries. Included with Java is a huge collection of programming tools, such as encryption algorithms, file and web access, math functions, and database control. It is easy to call these from the MID server, as follows:

var out = new Packages.java.io.FileWriter("file.txt"); 
out.write("Hello, world!"); 
out.close(); 

Java classes are organized ...

Get ServiceNow: Building Powerful Workflows now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.