Notifications
Announcements
No record found.
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:
Could you please provide X++ examples for all patterns or suggest where I can find them?
Thank you!
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
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
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.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 646 Most Valuable Professional
André Arnaud de Cal... 529 Super User 2025 Season 2
Sohaib Cheema 285 User Group Leader