Multiple tickets

nick71
Kilo Contributor

a server has generated multiple alerts which has created multiple tickets onto our Service Now Instance. Is there any quick way these tickets can be bulk closed? A suggestion was to delete them as they relate to all the same issue, but I an concerned with this way.

Please advise of any suggestions  

13 REPLIES 13

Ivano B
ServiceNow Employee
ServiceNow Employee

Hi Nick



Ok you can execute a mass update as script background


Navigating to this section in the system



ServiceNow.png




than put a code similar to this one



var gr = new GlideRecord('YOUR_TABLE_NAME_HERE');


gr.addQuery('short_description', 'YOUR_SHORT_DESCRIPTION_HERE');


gr.addQuery('customer', 'YOUR_CUSTOMER_SYS_ID_HERE');


gr.query();


while(gr.next()){


    gs.print(gr.number);


  //gr.state = 7;


  //gr.update();


}



When you remove the comment from the last 2 lines the update will be executed so be very careful.


Check the query and let me know if this makes sense for you



Cheers


R0b0


Ivano B
ServiceNow Employee
ServiceNow Employee

HI Nick



Please disregard my query above.


The condition is not enough because you need to set also the date otherwise will update all the records.


So please be very careful in case you want to use the back ground script !


In that case you need to change the query to be more specific



Cheers


R0b0


vinothkumar
Tera Guru

Hi Nick,



You can do the same by writing a one time scheduled job by navigating to system definition > scheduled job, but you have to be more accurate in the encoded query. for getting encoded query, open the incident in the list layout and filter it based on condition and right click and select copy query.



I have just mentioned the state alone here, you can also add fields.



var m = new GlideRecord('incident');


m.addEncodedQuery('active=true^assigned_to=javascript:getMyAssignments()^stateNOT IN3,4,7');


m.query();


while(m.next())


{


m.state = value of closed state of incident;


m.close_notes = "comments whatever"


m.update();


}


Thanks for all suggestions. I went down the route of checking all relevant messages and then selecting the "update selected" option, filling out the form and saving.