Auto Resolve Incidents

Rick Kenny1
Kilo Explorer

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.  

1 ACCEPTED SOLUTION

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();


        }


})();


View solution in original post

7 REPLIES 7

Chuck Tomasi
Tera Patron

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


GlideRecord - ServiceNow Wiki


Thanks for the quick response   - - - - - since these Incidents are created throughout the day, could the scheduled job run "EX:   every 30 mintues"?


Absolutely. Here's an example of every 1 hour. Just change it to 30 minutes by using 00, 30, 00 in the fields next to Hours.



find_real_file.png


Not the best at scripting (for now) but here is the current business rule we were attempting -


When to run.JPG



Action.JPG



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.