script to print incidents
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 01:00 AM
Write a script to print incidents created before 3 months without EncodedQuery.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 01:06 AM
Hi @shid077
use below script
var gr = new GlideRecord("incident");
gr.addQuery("sys_created_on",'<' , gs.beginningOfLast3Months());
gr.query();
while (gr.next()) {
gs.info(gr.getValue('number'))
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 01:25 AM
Hi @shid077 ,
Try this in background script :
var gr = new GlideRecord('incident');
gr.addQuery('sys_created_on', '<', gs.beginningOfLast3Months());
gr.query();
while (incidentGR.next()) {
gs.info('Incident Number are : ' + gr.number );
}
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....