jobs can be run using job queues. in the job queue entry card you can set a codeunit or a report to run periodically. periods can: minutes to days. it is also possible to run a job once a week.
not possible: run a job monthly.
here are some solutions.
the simple solution:
goto page “job queue entry card” and set “no. of minutes between runs” to a value like 43200 (= 60 * 24 * 30). that is the minute value for an average month. the exact average value is 60 * 24 * 365,25 / 12 = 43830 min.
advanced solution:
edit cu 448 and change fct. CalcNextRunTimeForRecurringJob according to your special needs. There change the calc. formula for NewRunDateTime.
to run a job monthly set “No. of Minutes between Runs” to 0.
create new global var. Monthly: Boolean.
change fct. CalcRunTimeForRecurringJob:
…
IF Found THEN
NewRunDateTime := CREATEDATETIME(DT2DATE(StartingDateTime) + NoOfDays,NewRunTime);
IF Monthly THEN BEGIN
LastOfMonth := CALCDATE (‘CM’, DT2DATE(StartingDateTime));
NewRunDateTime := CREATEDATETIME(LastOfMonth, NewRunTime);
END;
new fct. RunMonthly(monthlyPar: Boolean)
Monthly := monthlyPar;
Hi Jonathan,
I have tried advance solution. i have created two fields in job queue entry. Periodically (Boolean) and period (calcformula) so that i can run based on periods (15D, 1M). but next run date is doubled up (15D +15D).
for your advance solution, where this following function we call.
new fct. RunMonthly(monthlyPar: Boolean)
Monthly := monthlyPar;
Thanks for your post.
Regards,
Rajesh
LikeLike
please publish your complete code.
LikeLike