- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2019 08:36 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2019 09:15 AM
Create a scheduled job:
Create a script include:Below is the code from the screenshots:
Scheduled Job:
new closeIncidents().close();
Script Include:
var closeIncidents = Class.create();
closeIncidents.prototype = {
initialize: function() {
},
close: function() {
var incidents = new GlideRecord("incident");
incidents.addEncodedQuery("active=true^sys_created_on<=javascript:gs.beginningOfLast30Days()");
incidents.query();
while(incidents.next()) {
incidents.state = 6;
incidents.update();
}
},
type: 'closeIncidents'
};
Please mark this as correct/helpful if it resolved your issue!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2019 08:40 AM
Business rules only run on insert/update of a record. You need to convert this business rule into a scheduled job that runs once a day at a specified time (or whenever you want).
If this resolved your issue please mark as helpful/correct!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2019 08:56 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2019 09:15 AM
Create a scheduled job:
Create a script include:Below is the code from the screenshots:
Scheduled Job:
new closeIncidents().close();
Script Include:
var closeIncidents = Class.create();
closeIncidents.prototype = {
initialize: function() {
},
close: function() {
var incidents = new GlideRecord("incident");
incidents.addEncodedQuery("active=true^sys_created_on<=javascript:gs.beginningOfLast30Days()");
incidents.query();
while(incidents.next()) {
incidents.state = 6;
incidents.update();
}
},
type: 'closeIncidents'
};
Please mark this as correct/helpful if it resolved your issue!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2019 09:23 AM
I don't want to Close them, I want to Resolve them.. So do I just change where you have Close put Resolved?