Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Run batch job within a certain time interval

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
    Sergei Minozhenko 23,089 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
    Elda Mataj 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
    Sergei Minozhenko 23,089 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans