Retry Mechanism & Error Handling for Scheduled Job
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
We have Implemented Integration using Rest method to get data into ServiceNow staging table using Scheduled job.
Is it possible to implement Retry Mechanism & Error Handling for Scheduled Job whenever it fails.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello Balakrishna,
You can try to implement a retry mechanism and error handling in your Scheduled Job with TRY-CATCH and a loop
I would suggest wrapping the REST call in a Try-Catch block and implementing a limited retry mechanism for transient failures, such as timeouts or HTTP errors. Capture the HTTP status code and error details in system logs or a dedicated integration log table.
If all retry attempts fail, trigger an event or notification to alert the support team that REST Failed. Also, ensure to break loop when records are success and are not duplicated during retries.
There are some refrences below Snow Doc link
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Balakrishna_ABK ,,
Yes, it is possible to implement retry and error handling for a Scheduled Job.
You can handle this in your existing REST integration script by checking the HTTP status code and catching exceptions.
For example:
-
Retry the REST call for temporary failures, such as HTTP 429 or 5xx errors.
-
Log the error details, including the HTTP status code and response body.
-
Maintain a retry count and stop after a configured number of attempts.
-
If all retries fail, log the failure and send a notification to the support team.
-
For more reliable processing, you can store failed requests in a custom retry table and let a separate Scheduled Job retry them later.
I would recommend limiting retries and using a delay between attempts rather than retrying continuously. Also, avoid retrying permanent errors such as HTTP 400 or 401 without correcting the underlying issue.
Regards, Tejas