- 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:48 AM
Hi Richard,
Here is the sample script. You have to just adjust this script addQuery and setValues as per your req.
updateIncidnet();
function updateIncidnet() {
var gr = new GlideRecord('incident'); // I believe that's the table
gr.addQuery('state', 2);
gr.query();
while (gr.next()) {
gr.state = 6;
gr.update();
}
}
With the help of Encoded query you can copy the filter and adjust it as part of your addQuery in script.
Encoded Query Strings - ServiceNow Wiki

- 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:52 AM
Thank you Chuck and Pradeep - this will get us off on the right foot. Awesome service - support !!!!