How to run a schedule job B after 7 days of Scheduled Job A runs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 06:07 AM
Hi,
I have a scheduled job B that needs to run after 7 days of a scheduled job A runs.
for scheduled job A: we restricted it to run only on particular day of particular months. example : months:[3,5] , day:[1,20](had this in system property).
so whenever A runs after 7 days B should also run. how to achieve this?
thanks in advance
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 06:17 AM
Hi Viswasri,
What are doing in these schedule jobs ? If you are updating some records, then create a date field in that table and populate that field with date time when schedule job A ran, and schedule job B should compare that field with current date and check whether 7 days have passed then only it should execute the required script and should run everyday
OR
You can use the same logic as A but increment 7 days like months:[3,5] , day:[8,27]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 06:42 AM
I need to trigger emails I cannot have another system property since this is an escalation

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 06:21 AM
Hey,
You can have your code written for the main scheduled job, and you can run your other schedule job from the main one itself by explicitly using below code:
function runChildJob{
var schJob = new GlideRecord('sysauto_script');
schJob.newRecord();
schJob.name = "name of scheduled job";
schJob.active = true;
schJob.run_type = 'once';
var ed = new GlideDateTime();
ed.addDays(7);
schJob.run_start = ed;
//add more details which you want
schJob.insert();
}
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 06:49 AM
thanks a lot will try this