gliderecord examples

rangadevi
Kilo Contributor

HI Team,

Can you please provide real time scenarios for the glide record and for script includes.

4 REPLIES 4

Jaspal Singh
Mega Patron
Mega Patron

Hi Rangadevi,



Links below should help you understand better.



Glide Records - GlideRecord - Scoped & Using GlideRecord to query tables


Script includes - Script includes & sample example for script include call from client script


Mujtaba Amin Bh
Mega Guru

Chuck Tomasi
Tera Patron

Hi,



Yes, I've done some videos this. In invite you to watch ep 6 of TechNow for script include information.


TechNow Episode List



GlideRecord is the Javascript API for interacting with the database. An example:



// Get all incidents


var inc = new GlideRecord('incident');


inc.query();



while (inc.next()) {


        gs.info(inc.getDisplayValue());


}



If you want add filters, use the addQuery() method like this...



var inc = new GlideRecord('incident');


inc.addQuery('active', true); // get only records where the active field is true


inc.query();



while (inc.next()) {


        gs.info(inc.getDisplayValue());


}



There are plenty of other methods to use for update/creating/deleting records. In invite to read the documentation with examples and watch some of the other videos.



https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_GlideRecord-GlideRecord_S


Thank you so much Chuk for response.