RemoteGlideRecord Revisited

So there was a request to bring back an old article on RemoteGlideRecord.  I am fairly certain ServiceNow will want to deprecate this Package.  I have tested the following in Eureka and it still works but I don’t know for how long.  Of course, even if you use this and it gets deprecated you always have the option of another integration type.

So what is RemoteGlideRecord?  It is a Package that allows you to use GlideRecord to query from one ServiceNow Instance to another.  If you are interested, behind the scenes this is executing a SOAP Request and uses Basic Authentication to authenticate to the second instance.

To create a basic instance of the Package use the following syntax.

var gr = new"", "TABLE");
gr.setBasicAuth("USER", "PASS");


Of course replace INSTANCE with your target instance, TABLE with the target TABLE and USER/PASS with the user and password.

WOAH!  Wait a second.  I don’t want to store my passwords in plain text in a script file!

Great point.  So here is an example of the Encrypter class.  You can encrypt and store passwords as properties and decrypt them when you need them.

var encrypter = new GlideEncrypter();
var encryptedPass = encrypter.encrypt("test");

gs.log( encrypter.decrypt(encryptedPass) );


Once we have the basic object set up the query can be executed.  Here is a sample of the code to run that query complete with some error checking to make sure the connection is valid.

if (gr.isValid()) {

while ( {

} else {
gs.print("not valid");


Notice that you cannot just dot.walk to the field name you must use getValue, getDisplayValue, getIntValue, getBooleanValue.

Likewise setting a value is done with setValue(field, value).

There are also a few configuration options which may or may not help you.

setAcceptGZIP(boolean) and setSendGZIP(boolean) obviously instruct the RemoteGlideRecord to send and receive GZIP.  This should be true.

setRedirectSupported(boolean) I can only assume tells RemoteGlideRecord to follow redirects, although I cannot test this theory.

setupProxy( host, port, user, pass ) seems like it can route the call through a proxy although I can think of no reason why that would ever happen.

setReturnDisplayValue(boolean) will turn of returning display values, if you aren’t planning on using them it can save some bytes off of what gets transferred.

setDebug(boolean) turns off and on debugging.  Off by default this will add invaluable log outputs that will definitely help if you don’t get connected straight away.

There is also a RemoteGlideAggregate which extends RemoteGlideRecord.  Seems to have the same methods as a standard GlideAggregate.  So there’s that to try as well.

Leave a Reply

Your email address will not be published. Required fields are marked *