how to auto-close resolved cases after 5 business days

Community Alums
Not applicable

Hi all, 

I have a requirement to auto-close the resolved cases after 5 business days. Currently, we are using a flow to auto-close the resolved case after 5 calendar days.
I have added a condition to check if the resolved date is relative on/before 5 days ago. 

Now I have to add a schedule to this flow and I am out of ideas. Appreciate any suggestion and help.

Thanks in advance,
Ashwin 

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi Ashwin,

 

You can create two custom fields on account level, Support schedule and resolution duration.

Resolution duration can be vary for each account (5,7,10 days) & support schedule for each account may vary too.

 

You will have to create expected close time field on case table as well.

 

When case gets resolved then you can have below code in your before Update Business rule -

var resolved_date = current.resolved_at;
var startDate = new GlideDateTime(resolved_date);
var sched = new GlideSchedule(current.account.support_schedule);
 
var timeToAdd = current.account.resolution_duration.getGlideObject().getNumericValue
();
 
var durToAdd = new GlideDuration(timeToAdd);
var endDate = sched.add(startDate, durToAdd, '');
current.expected_close_time = endDate;
 
This will update expected close time on case and you can create your own custom flow to to run daily and check and compare expected close time.
 
Please mark my answer correct and helpful if it helps you in any way.
 
Best regards,
Kanhaiya

View solution in original post

2 REPLIES 2

Vishwa Pandya19
Mega Sage

Hi Ashwin,

 

Below article should be able to help you.

https://www.servicenow.com/community/developer-articles/article-16-run-flow-hourly-monday-friday-8-0...


If my answer helped you in any way please mark it as correct or helpful.

Community Alums
Not applicable

Hi Ashwin,

 

You can create two custom fields on account level, Support schedule and resolution duration.

Resolution duration can be vary for each account (5,7,10 days) & support schedule for each account may vary too.

 

You will have to create expected close time field on case table as well.

 

When case gets resolved then you can have below code in your before Update Business rule -

var resolved_date = current.resolved_at;
var startDate = new GlideDateTime(resolved_date);
var sched = new GlideSchedule(current.account.support_schedule);
 
var timeToAdd = current.account.resolution_duration.getGlideObject().getNumericValue
();
 
var durToAdd = new GlideDuration(timeToAdd);
var endDate = sched.add(startDate, durToAdd, '');
current.expected_close_time = endDate;
 
This will update expected close time on case and you can create your own custom flow to to run daily and check and compare expected close time.
 
Please mark my answer correct and helpful if it helps you in any way.
 
Best regards,
Kanhaiya