March 2017
Beginner
358 pages
9h 51m
English
The deleteMultiple() method can be called either after the query(), or without it, but without calling next():
var query = 'active=false^closed_atRELATIVELT@year@ago@2'; //Tickets closed more than 2 years ago var gr = new GlideRecord('incident'); gr.addQuery(query); gr.deleteMultiple();
In this case, I'm running this on the Incident table, which in my instance does not have any currency fields. Again, this method should not be called on any tables that contain currency fields due to a limitation in ServiceNow. Instead, use the following deleteRecord() syntax:
var query = 'active=false^closed_atRELATIVELT@year@ago@2'; //Tickets closed more than 2 years ago var gr = new GlideRecord('incident'); gr.addQuery(query); gr.query(); ...Read now
Unlock full access