Auto Close Incident after 5 days of resolution only for P1/P2

SanikaK
Tera Contributor

Currently incident is auto-closed after 3 days of resolution in ServiceNow. Want to know if it is technically feasible to have a 5 days auto-closure set only for P1/P2 incidents and not for all.

There is OOO system property ''glide.ui.autoclose.time" (attaching the screenshot for reference). This property is not set for any specific priority.


5 REPLIES 5

svirkar420
Tera Guru

HI @Sanika , You can do this with help of a schedule job, to check if incident of p1/p2 is resolved before 5 days ago, the state should be updated to closed.

Make a schedule job to run daily basis, glide to inc table using schedule job script.

Here is a demo script - 
var gr = new GlideRecord('incident');
gr.addEncodedQuery('priorityIN1,2^resolved_atRELATIVELT@dayofweek@ago@5^state=6'); //modify query according to requirement.
gr.query();
while (gr.next()) {
gr.state = 7; // 

//update other fields according to you.
gr.update();
}

 

If this response helped resolve your issue or question, please consider marking it as Accepted Solution and giving it a 👍.This helps others in the community find useful answers more easily.

Regards,
Saurabh V.