The CreatorCon Call for Content is officially open! Get started here.

How to use GlideRemoteGlideRecord in a scoped application ?

Agnibha
Kilo Explorer

We tried to run the following script in our instance. It is working fine in Global Scope but showing an error in a scoped application. Error is attached as an image.

var remote_instance = "https://dev70329.service-now.com/nav_to.do?uri=%2Fhome.do%3F";
var table_name = "incident";
var r = new GlideRemoteGlideRecord(remote_instance, table_name);

// Set up the authentication
var username = "admin";
var password = "*****";
r.setBasicAuth(username, password);

// Perform the query
r.addQuery("number", "INC0009009");
r.query();
while( r.next() ){
gs.print("Short Description: " + r.getValue("short_description") + " (P): " + r.getValue("priority"));
}

3 REPLIES 3

MrMuhammad
Giga Sage

Hi,

GlideRemoteGlideRecord is not available in scoped application. Alternatively you can leverage Servicenow REST Table API's to interact with remote instance.  You can Create, get, update and delete record on remote instance.

Ref - https://developer.servicenow.com/dev.do#!/reference/api/orlando/rest/c_TableAPI

I hope this helps!


Thanks & Regards,

Sharjeel

Regards,
Muhammad

asifnoor
Kilo Patron

Hi,

Unfortunately you cannot use GlideRemoteGlideRecord in scoped application, which was so nice to have.

You have to use REST API GET method to fetch the data when using scoped applications. Check out REST API Explorer (in your left navigation) for sample code.

Mark the comment as a correct answer and helpful if it answers your question.

Aoife Lucas
Giga Expert

I never even knew this existed, but then again, I wouldn't use anything that used Basic Auth between instances.  I have setup a similar concept with a generic e-bonding set of scripts that uses OAuth between the instances.  It detects what fields are updated, the type of the field and can send Comments, Work Notes and Attachments, as well as all other field types that are simple to send.  I might be persuaded to share for a good bottle of Irish Whiskey.  🙂

Tapadh leat,

Aoife