How to set up job que to auto generate reports in Navision 2013 R2?
How to set up job que to auto generate reports in Navision 2013 R2?
Hello,
Here is a general overview of How to Set Up a Job Queue:
The Job Queue is a Microsoft Dynamics NAV feature that allows you to schedule the running of Reports and Codeunits. You can also use the Job Queue to run them just once. There are a few processes in NAV that rely on the Job Queue such as Background Posting and Email Logging, but it can also be used for things like Automated FX Rate updates or running things like integrations.
If you want to schedule your reports to run in the background – which is a feature added for all reports in the system from NAV 2015 onwards – then you will need to have a Job Queue running.
The Job Queue is setup in two parts.
The first thing we have to do is set up a NAV service (NAS) to run our Job Queue on our NAV server (NST). Since Dynamics NAV 2013, the NAS has become a part of the NST. What this means is that you can add the NAS you are creating to your client NST, so that when you restart or stop your client, all connections are stopped. Or if you want a more granular level of administration, then you could create a separate NST to run the NAS and thus your related Job Queue. It really depends on your personal preference and situation.
Here I am configuring the NAS to run on the same NST that we have the RoleTailored Client accessing.
Note that we are setting up the NST to run the NAS to exclusively run the Job Queue – this means for the Startup Codeunit I can just enter 450. If you wanted to configure the NAS for something different you would need to enter the details in the Startup fields.
We also need to specify the Services Default Company to use. In this case I have entered the demo company “CRONUS Canada, Inc.”. When the NAS is running it will assume the security context of the service account that is running the NST – that’s the technical way of saying that we need to add the service account that is running the NST to Dynamics NAV as a user and give it permissions:
In this case we are using Network Service and have given that account the Super permission set. For a production environment, we recommend using a domain service account and only giving it the required permissions sets to run the codeunits and reports you are going to run on the Job Queue. Now after restarting this NST, it will run the NAS and start any Job Queues we have setup.
All of the records related to the Job Queue can be found in the Job Queue menu located in Departments -> Administration -> Application Setup -> Job Queue
Some definitions:
To setup a new Job Queue open the list from the menu and select “new”.
Here I configured a default queue. I left the fields Start on This NAS Computer and Start on this NAS Instance blank but these fields could be used to dictate where this Job Queue would run. If you wanted to start the Job Queue without running it via the NAS you could press the Start Job Queue button but this would only run until you closed the current windows client down. This can be useful when trying to debug issues you are running into on the Job Queue.
After restarting the NST and going back into my Job Queue card, I can see that this job queue is now running on the NST. There are now values in the Running as User ID, Running on Server Computer and Running on Server Instance. Next we need to add codeunit or report to run. For this we need to create a new record in the Job Queue Entry table:
Here I have setup a Job Queue Entry to run the codeunit 5917 which is a step needed in the bigger process of enabling Logging and Tracking Email Interactions
I set the Object Type to Run as “Codeunit” and the Object ID to Run as “5917”. I then enabled the boolean for Run on Mondays through to Run on Sundays. This automatically enables this as a recurring job so it will not be deleted after running successfully. I also set the No. of minutes between Runs to be 15; This means that the job will run every 15 minutes until we stop it.
There are a few other things to do before this job will run, though. Currently its Status is “On Hold”, we need to press the Set Status to Ready button to advise the Job Queue that it can run this Job Queue Entry. This will populate the Earliest Start Date/Time for us. We can edit this field if we need to and control when the job runs.
One important note about the Starting Time and Ending Time – they are not in your local time, instead they are UTC (looking up the fields in help will show this too), however the Earliest Start Date/Time is local. Which can be confusing. However, let’s say I want the job to start at 1:30am my local time (PST). UTC is 7 hours head of PST so I would set this time to be 08:30am. A bit confusing to start, but once you have it figured out it works fine.
The Job Queue has a number of other small features and functions that we can use to get a deeper level of control; however, the steps here are the basics for getting your Job Queue up and running.
I hope this helps.
Thanks,
Steve
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,532 Super User 2024 Season 2
Martin Dráb 228,501 Most Valuable Professional
nmaenpaa 101,148