Condition Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2023 09:31 AM
Hi team, is there a possibility to add a custom field to the scheduled jobs form, allowing the user to choose how many months until the scheduled job is triggered again? For example, if they want it to run on a quarterly basis, they can simply select '3 months' instead of using a Condition Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2023 12:40 PM - edited 09-02-2023 01:09 PM
Hi yoli1,
You can use Run: "Periodically" and Repeat Interval: Days: "90"
Or you can choose 'Business Calendar' and select the OOB "Quarter". And define the desired entries for that Business Calendar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2023 06:22 AM
Hi @Bert_c1 Thanks, but choosing 60 days isn't always right as we don't have 30 days every mouth we might have 31 days in a month. and thank for your suggestion about using the Business Calendar. but with Business Calendar = Quarter what should the Run field be set at ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2023 06:51 PM
I think you can create a custom field on scheduled job to determine the next custom schedule run, if you are absolutely didn't find a solution with what we have in OOB. Along with the custom new field following script would help to calculate next action date.
// Assuming you have a custom field "months_until_next_run" on the Scheduled Job form
var monthsUntilNextRun = current.months_until_next_run;
if (isNaN(monthsUntilNextRun) || monthsUntilNextRun <= 0) {
// Handle invalid input
gs.addErrorMessage('Please enter a valid number of months.');
current.setAbortAction(true);
} else {
// Calculate the next run date
var currentDate = new GlideDate();
currentDate.addMonths(monthsUntilNextRun);
// Update the "Next Action" field with the calculated date
current.next_action = currentDate;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2023 09:08 PM
Hello @varaprasad123 ,
Yes you can create custom field on scheduled job table and use it for date.
But to you need to override the OOTB includes that trigger the execution of the scheduled job (field - starting).
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Thank You,
Rajesh