How to schedule job to close resolved or On Hold Awaiting Caller after 5 days

Lucas11
Tera Contributor

Good morning guys, I would like to know what is the script for the schedule job, where when an incident is 5 days in state Resolved, or state On Hold Awaiting Caller, it is automatically closed.

 

So far I have nothing and I don't even know where to start, I have no experience with scripts.

 

Thank you so much guys!

2 REPLIES 2

lmundere
Kilo Sage

hi Lucas, the easiest way is to use a flow, with a trigger condition state change to awaiting caller, then add a wait condition for 5 days, if the condition is still true, then set the record to Resolved

Abhijit4
Mega Sage

Hi, 

To find out incident resolved 5 days before you can use below condition in scheduled job or flow designer :

resolved_atRELATIVELT@dayofweek@ago@5^state=6

Abhijit4_0-1667568912297.png

 

This is possible for resolved state because system stores resolved date. However, for On Hold Awaiting Caller case, it is not possible this way. Either you would neede to use flow designer to wait for 5 days as suggested by @lmundere  or create new date-time field to store 'On Hold Awaiting Caller' state moved datetime and use above approach to find out required records.

 

Please mark answer as Correct or Helpful based on impact.

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP