var gr = new GlideRecord('change_request'); gr.addQuery('state', '-1'); gr.addQuery('number', 'CHG0030780'); gr.query(); while(gr.next()) { gr.state=3; gr.close_code='successful'; gr.close_notes='Closing this change manually due to known error'; gr.setWorkflow(false); gr.autoSysFields(false); gr.update(); }