The Job Queue granule (3,810) in version 5.0 and later can be used to automate tasks by starting Nav Application Server with the parameter JOBQUEUE. Everyting that Job Queue starts is started with a record in the table Job Queue Entry. However, there are built in batches, like report 795, Adjust Cost – Item Entries, that Job Queue can start with some help. Here is a Report that I use to start built in batches from Job Queue.
Here is a zip file with the code needed.
16 Replies to “Job Queue Execution”
How is this different from just running say report 795 from jobqueue? You still need to modify them to not display and dialogs, correct?
This will have GUIALLOWED = FALSE and ISSERVICETIER = TRUE
Looks great, your solution for easy scheduling of jobs. Saves us the time for customizing reports and codeunits. Tested a little with 2 reports, 795 and 5199. The good news: both reports run without any error generated in the Job Queue Log Entries! The bad news: none of the reports seem to have done their job. I.e. create a valued adjustment journal or update the Questionnaire Profile answers.
I used the Parameter String as described: Report::795 and Report::5199.
Am I missing something here? Any additional setup needed?
I did not need to do anything else to get this to work.
Okay, I’ll test again. Thanks!
This seems like a great idea. Unfortunately it does not seem to work for me. In Report 795 there is a call to codeunit 5895 Inventory Adjustment:
And in this codeunit the first thing that happens (almost) is that a Window is opened:
MaxLevels := 100;
WindowUpdateTime := TIME;
IF NOT IsOnlineAdjmt THEN
This makes the Jobqueue halt, how did you guys get around this? You could ofc set the variable IsOnLineAdjustment to TRUE but then we would never get the dialog even when manually running report 795.
I changed the OpenWindow function in codeunit 5895 to make sure that the window is only opened if running from a client.
IF GUIALLOWED THEN BEGIN
WindowIsOpen := TRUE;
when i run report 795, Adjust Cost – Item Entries through job queue in runs in infinite loop it it take almost more than 24 hrs
Perhaps you can try one Item at a time ?
A Batch looping through Item:
Item – OnPreDataItem()
PostingDate := TODAY;
Item – OnAfterGetRecord()
“Cost is Adjusted” := FALSE;
IF NOT ItemApplnEntry.FINDLAST THEN
IF NOT ItemLedgEntry.FINDLAST THEN
IF AvgCostAdjmtEntryPoint.FINDLAST THEN;
IF NOT ValueEntry.FINDLAST THEN
Item2 := Item;
Item – OnPostDataItem()
Always gives me this error:
You cannot use C/AL variables of type DIALOG when running the Application Server for Microsoft Dynamics NAV Classic.
In older versions of NAV you need to disable all confirm and message dialogs.
My version is 2009 R2.
That is an older version.
OK, How to do that in this NAV?
You need to change the code you are executing. You can use the variable GUIALLOWED that will give True for the Client but False for NAS.
Thanks, worked fine.