Auto close resolved incidents business rule and scheduled item is not working as expected
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 11:42 PM
We have defined business rule, scheduled item, and system property to auto close the particular resolved incidents, but not closing the incidents and not getting any logs in system logs. can someone please help on it. here am pasting BR, schedueld item, and system property. for testing purpose we can not wait for days. is there any way that we can set some minutes.
after BR:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
autoCloseIncidents();
function autoCloseIncidents() {
var ps = gs.getProperty('glide.ui.securityincidentautoclose.time');
var pn = parseInt(ps);
var queryTime = new GlideDateTime();
queryTime.addDaysUTC(-pn);
//queryTime.addSeconds(-pn);
if (pn > 0) {
var gr = new GlideRecord('incident');
gr.addEncodedQuery('category=IT Security^u_security_incident_stateNOT INproposed,accepted,rejected^incident_state=6');
// gr.addQuery('sys_updated_on', '<', queryTime);
gr.addQuery('sys_updated_on', '<', queryTime);
gr.query();
while(gr.next()) {
gr.state = 7;
gr.setLimit(3);
gr.comments = 'Incident automatically closed after ' + pn + ' days in the Resolved state.';
gr.active = false;
gr.work_notes="Auto closed resolved incidents through Business rule";
gr.closed_by = gr.resolved_by;
gs.log("The resolved incidents are closed");
gr.update();
}
}
}
});
scheduled item:
System Property:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2022 12:05 AM
Hi,
I could see you have created similar questions in past which already have comments from members
Please avoid duplicate questions
Auto close business rule is not working with scheduled item
auto resolve closed incidents business is not working as expected
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2022 12:14 AM
Sorry for that, as i could not get correct help with that question, thought to create new one, can you please help here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2022 12:25 AM
I already shared the solution/approach on your older question.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2022 04:26 AM
it seems no log is getting generated in system logs, means the BR itself is not triggering. can you please help me why this BR is not getting triggered