Posts

Showing posts from 2017

Glide Record Query Examples

**** Glide Record Query Examples *** Query:- var rec = new GlideRecord('incident'); rec.query(); while (rec.next()) { gs.print(rec.number + 'exists'); } Update:- var rec = new GlideRecord('incident'); rec.addQuery('active',true); rec.query(); while(rec.next()) { rec.active = false; gs.print('Active Incident' + rec.number = 'closed'); rec.update(); } Insert:- var rec = new GlideRecord('incident'); rec.initialize(); rec.short_description = 'Network problem'; rec.caller_id.setDisplayValue('Joe Employee'); rec.insert(); Delete:- var rec = new GlideRecord('incident'); rec.addQuery('active',false); rec.query(); while(rec.next()) { gs.print('Inactive incident' + rec.number + 'deleted'); rec.deleteRecord(); } OR Query:- var gr = new GlideRecord('sc_item_option_mtom'); gr.addQuery('sc_item_option.item_option_new.name','item_name...