- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2016 05:09 AM
What is the best way to "Auto Resolve" Incidents that have been submitted. There is currently an inbound email action that auto generates an Incidents and uses the auto-assignment rule for assigning, however, based on certain assignment groups, would like to auto resolve incident those certain groups. Attempted to use a business rule to no success.
Any recommendations would be greatly appreciated. Currently have the "autoclose" running that marks all resolved incidents closed - but need to find the best way to auto resolve incidents from this inbound email action for certain groups only.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2016 05:49 AM
Hi Richard,
Here's a start at the untested script. There's quite a bit of looking up for sys_ids and choice list values for your script, but the guts are pretty much the same.
(function () {
var inc = new GlideRecord('incident');
inc.addQuery('short_description', 'Accel Ops'); // update to your proper short description
inc.addQuery('assignment_group', 'sys_id_of_assignment_group'); // use proper sys_id
inc.addActveQuery(); // active=true
inc.addQuery('state', 1); // I believe that's the value for New
inc.addNullQuery('assigned_to');
inc.query();
while (inc.next()) {
inc.assigned_to = 'sys_id_of_accel_ops';
inc.resolved_by = 'sys_id_of_accel_ops';
inc.close_notes = 'Your close notes here';
inc.closure_code = 5; // Use the right value of Access Denied
inc.state = 6; // resolved
inc.incident_state = 6; // resolved
inc.update();
}
})();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2016 05:12 AM
Hi Richard,
Business rules react to database changes so if nothing changes, the BRs don't run. What you want is a scheduled job (hourly, nightly, whatever) that goes through the list of incidents and looks for those criteria you specify (e.g. active, not already resolved, assigned to certain groups.)
Creating a Scheduled Job - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2016 05:15 AM
Thanks for the quick response - - - - - since these Incidents are created throughout the day, could the scheduled job run "EX: every 30 mintues"?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2016 05:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2016 05:36 AM
Not the best at scripting (for now) but here is the current business rule we were attempting -
Based on the information you provide, guessing a "Scheduled Script Execution" would be the best to use, based on condition that would run the script. Unfortunately there are not any good examples as to what the scripts should look like for conditional or "run the script"? Any assistant that can be provide would be appreicated.