Schedule job

RoshaniB
Tera Expert

we will do the development and deployment of an automation in that identifies and closes IT requests that have remained in an “Awaiting Approval” state for more than 45 days without any activity.

Automation will be built as mentioned below.

-Detect IT requests that have had no updates from the requestor within the 45‑day period.
-Detect requests where the assigned approver has taken no approval action (approve or reject) during that timeframe.
-Automatically transition qualifying requests to a Closed – Inactive status.
-Add a standardized system‑generated comment at closure to inform users of the reason for the auto‑closure and the appropriate next steps.

Auto‑Closure Comment:
“This request is proposed to be automatically closed due to inactivity while awaiting approval. No updates or approval actions were recorded during this period. If access or support is still required, the requestor may submit a new request.”     

 

can anyone suggest me easily way to do it I'm getting error in this request

5 REPLIES 5

Ankur Bawiskar
Tera Patron

@RoshaniB 

so what you started and where are you stuck?

This looks like a complete big requirement.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

I was try to do this by schedule job but the script is not working can you please suggest any simpler method to achieved this?

@RoshaniB 

what script and what's not working?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Tanushree Maiti
Kilo Patron

Hi @RoshaniB 

 

Probable logic for the scheduled job:

  • Query the sysapproval_approver table where state is Awaiting Approval.
  • Filter records where sys_updated_on is more than 45 days ago.
  • For each qualifying record:
         Transition the associated request (e.g., change_request, sc_req_item) to Closed – Inactive  //update it which state available in your project.
  • Set approval record to Cancelled .
  • Add a system-generated comment " This request is proposed to be automatically closed due to inactivity while awaiting approval. No updates or approval actions were recorded during this period. If access or support is still required, the requestor may submit a new request."  to the Tickets' Work notes.

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: