web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Skip batch job execution on certain dates

(1) ShareShare
ReportReport
Posted on by 6,478
Hello,
For some of our Batch Jobs we would like to skip the execution / reccurance on Holidays.
I have found the standard option which can skip the weekend days. We need something similar to it, or to "Active period" for holidays.
I have found "Holidays and closure" form where we can define our holiday days, but I couldn't understand how to achieve the goal technically.
My idea was to have relation from BatchJob table to "Holidays" table and if today's date is found in that table, it means today is a holiday and therefor Batch job must not start.
I could not find what methods to extends, etc, since most of the methods in RunBase classes where standard active period is used are internal ones.
This should work in all batch jobs which will have relation to holidays table, does not matter if it is created with runbase or sys operation framework.
Has anyone maybe implemented something similar and can give some tips?
Thanks!
Categories:
I have the same question (0)
  • Martin Dráb Profile Picture
    237,807 Most Valuable Professional on at
    Consider a simpler solution than changing the batch job framework: your batch will be scheduled, but it'll check if it's a holiday and if so, it'll end immediately. Wouldn't it meet your business requirements?
  • Johnny Profile Picture
    6,478 on at
    Hi Martin,
    I thought on that approach too, but we want it to be applied to all of our current batch jobs too by just selecting the Holidays reference from batch header, which isn't a little number.
    But if we can't find some general solution, we will go with that suggestion.
    Thanks
  • Martin Dráb Profile Picture
    237,807 Most Valuable Professional on at
    The solution for "we want it to be applied to all of our current batch jobs too" may be in changing the framework logic that actually executes the job (not the part that schedules jobs). Or write a script that adds the code to your batch classes.

    I see two other approaches than what I suggested, both difficult or even impossible (and therefore I would stick to the easier solution):
    1. You'll change all the logic of the batch framework that plans batch job. But you'll quickly find that it's not really extensible, therefore you'll have a hard time to design any way, and it's quite possible that it just can't be done. You would have to create some extensibility requests and wait a few months. To get some idea, look into BatchRun::serverProcessFinishedJobs(), which schedules the next batch after one ends.
    2. A much easier solution would be changing SysRecurrence::next(), but you want it just for some batches (and maybe to be able to choose a calendar), but you have no such a reference there. Maybe you could put it into SysRecurrenceData, although it's not really where such information belongs.
  • Johnny Profile Picture
    6,478 on at
    Thanks again. Yeah, I agree, I guess it will just cost us time and better to make it easy on framework and write a code directly on batch classes

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans