Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Run batch job within a certain time interval

(0) ShareShare
ReportReport
Posted on by 190
Dears,
We have a request for a batch job to run within a certain time interval 
And I couldn't use the already built in function from Microsoft for the recurrence as for example
A batch job needs to run from 08:00- 15:00, and when the time of the system change in 15:01 the status(field: BatchStatus) of the batchJob must change automaticly in Hold
I have created the table of parameters but I am not being able to identify which is the class which triggers the change of the status of the batchJob
Any help would be appreciated.
  • Sergei Minozhenko Profile Picture
    23,091 on at
    RE: Run batch job within a certain time interval

    Hi Eva,

    Could you, please, provide more information why you can't use built-in features?

    As i said previously, customizing batch framework itself is not a good idea. Maybe you can re-design approach with solution which is not required modifying batch framework: like seperate batch job, or you can still run batch job which is not supposed to run, but instead of executing logic, just skip it.

  • Elda Mataj Profile Picture
    190 on at
    RE: Run batch job within a certain time interval

    Hello Sergei,

    Thank you for your responese.

    I want to check the current time while executing the batch job. If the current time is not inside the interval based on my table of parameters, I want to change the status of the Batch in "Hold" and not execute the batch.

    And if the current time is inside the interval, I want to change the status of the Batch in "Executing" and execute the batch.

    Eva.

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,091 on at
    RE: Run batch job within a certain time interval

    Hi Eva,

    Do you want to check the current time after the execution of the batch job and based on parameters and current time set it to Waiting or Hold? I'm not sure if changing the batch framework is a good option for this requirement.

    Have you considered creating a new batch job (run it very frequently) that will go through your parameters and change status accordingly similar to BatchChangeStatus class?

    Also, there is an option to set up a period when AOS will accept batch jobs on "Server configuration" form (System administration - Setup - System - Server configuration). You can assign a batch group to AOS which will accept batch job sonly within a certain period.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,079 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,860 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans