Rerun scheduled export jobs automatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2022 11:15 PM
Hello,
We have few scheduled export jobs that runs on daily basis. Some jobs run successfully but some jobs failing with error. We can see the error in export logs as "Could not download file because: Socket error".
After manually running of this failed jobs they run successfully without error.
Is there any way to re-run the failed scheduled export jobs automatically ?
Appreciate your help!!
TIA,
Abdul Azeem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2022 11:32 PM
Hi,
you can run a daily scheduled job may be 10-15mins after your scheduled reports.
Check if they failed with that error and then run them from script again
like this -> enhance this script as per your requirement
var rec = new GlideRecord("sysauto_report");
rec.get("scheduledReportSysId");
gs.executeNow(rec);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 01:23 AM
Hi Ankur,
Thanks for you prompt reply.
May I know Is there any consequences of using gs.executeNow(); ?
Please suggest.
Kind regards,
Abdul Azeem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 04:37 AM
Hi,
Nothing as such.
It's an OOB code which allows you to run scheduled job/reports from script.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2022 11:36 PM
Hi
One way is to write the after update Business rule on sys_trigger table. Set the trigger conditions correct to determine that it should run only on errors and for the required scheduled job.
use gs.executeNow(current)
in the Business rule that will re-run the job.
Regards,
Muhammad
Muhammad