How to auto-close Case [sn_customerservice_case] record based on last updated date?

Aki17
Kilo Guru

I would like to make Case [sn_customerservice_case] records auto-closed which passed 10 days since last updated date.

*I understand that Incident table can be auto-closed by setting "glide.ui.autoclose.time", but not sure where to configure for Case table.

 

Please kindly tell me how to meet this requirement.

 

Best Regards,

Aki

1 ACCEPTED SOLUTION

Apeksha Joshi
Kilo Guru
3 REPLIES 3

Apeksha Joshi
Kilo Guru

Hi Aki ,

follow the link it might help you :

https://community.servicenow.com/community?id=community_question&sys_id=d1413cfcdbb8d7cc2e247a9e0f96...

https://docs.servicenow.com/bundle/newyork-customer-service-management/page/product/customer-service...

hope this helps !

mark as correct and helpful if it helps you in any way.

regards,

apeksha

Mandeep Karan
Tera Guru

Hi Aki,

You can write a scheduled job script to check the last updated time and close it.

Set the frequency to day or hour based on your requirement.

Regards,

Mandeep

Mohit Kaushik
Mega Sage
Mega Sage

Hi Aki,

You can use below Scheduled job script to auto close your cases after 10 days of last update:

 

var gr = new GlideRecord("sn_customerservice_case");
gr.addQuery('active', true);
gr.addQuery('sys_updated_on', '<=', gs.daysAgo(10));
gr.setLimit(550); // if you want to set limit in updating the records
gr.query();
while (gr.next()) {
gr.<state field name> =<value of closed> ;
gr.update();
}

Kindly refer the below link to see how to create a scheduled job

https://docs.servicenow.com/bundle/newyork-platform-administration/page/administer/reference-pages/t...

 

Please mark this answer as correct and helpful if it solved your query and only helpful if it helped you in any ways.

 

Thanks,

Mohit Kaushk

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)