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, ...
Answered

Setting Batch Job recurrence parameters in X++

(0) ShareShare
ReportReport
Posted on by

Hi Guys,

I am reading how to schedule job in X++ and looking for an example how to set all possible parameters in code.

For example, I didn't find how to set days, weeks or months recurrence parameters in code:

pastedimage1601884873849v2.png

Could you please provide X++ examples for all patterns or suggest where I can find them?

Thank you!

I have the same question (0)
  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi PolinaK,

    There is a class SysRecurrence used to specify recurrence. You can search for references in x++ for examples

    One of them is DocumentManagementSetup.scheduleOrphanScan

  • Blue Wang Profile Picture
    on at

    Hi PolinaK,

    As suggested by Sergei, you can use SysRecurrence::setRecurrenceUnit(sysRecurrenceData, SysRecurrenceUnit::Minute) to set reccurence pattern.

    Check this blog:

    d365technext.blogspot.com/.../batch-job-schedule-x.html

  • Community Member Profile Picture
    on at

    Thank you for response!

    Actually, I have already read this and similar articles and understood general idea.

    I am more interested how to set, for example,  "Per" parameter in code to run task every 3 months.

    Would appreciate any help.

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi PolinaK,

    You can start with method batch2Recurrence on SysRecurrence, it will create initial container for SysRecurrenceData. For simple setup you can use set* methods on SysRecurrence, for more complex set up, you most likely will need to manipulate with SysRecurrenceData container directly.

    SysRecurrenceData recurrenceData = SysRecurrence::batch2Recurrence(timeNow(), systemDateGet(), 3, BatchUnit::Month);
    
    recurrenceData = SysRecurrence::setRecurrenceNoEnd(recurrenceData);
    
    info(strFmt("%1", SysRecurrenceRun::toText(recurrenceData)));

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 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans