Wednesday 3 August 2016

Concept of Job Queues (Lets go through the path of NAS Service in Dynamics NAV)

Job Queue enables to request, control the processing of report and execution of codeunit.
In job queue entries window, we enter the request for execution of report/codeunit. 

Once the job queue execution of codeunit/report is done it will update its status of success/failure in Job queue log entries.


In NAV 2015, 2016 Job Queue can be activated in 2 ways.

1. Manually with credentials of Server instance.  
2. through NAS server with credentials of user.


Job queue uses NAS to run objects automatically. 

So, before understanding job queue we need to know what is NAS, why we need NAS.

In this blog I will be discussing particulary the concept of NAS and how to configure it in various versions of NAV.

What is NAS ?
NAS service is a middle-tier server component that executes the business logic without user interaction. 
In NAV it supports application like microsoft office outlook integration and NAV job queue.  

Why we need NAS?
  • Efficiency and convenience - Create a separate instance for each NAS Service so that it doesn't interrupt other services. 
  • Performance - Configuring NAS to separate instance makes better use of server computer. It allows us to run more application with less degradation.
  • Efficient error tracking - If the NAS service terminates then it can be handled like any other windows service by configuring the recovery tab on server configuration tool in control panel to manage service. 

Configuring NAS server in NAV 2009, 2013 is different from configuring in NAV 2013 R2, 2015, 2016.

Earlier all the services were separate but now we can see the services like Client, SOAP. ODATA, NAS, Management services all in one single administration tool. This makes a way by running one instance it will make run many services.


So as versions of NAV got changed configuring NAS service also became easy.

1.     Configuring NAS in NAV 2009 and 2013.

To do this you should have Application server manager for microsoft dynamics nav. 

Go to start, search for Application server manager for microsoft dynamics nav.
If you don't find any, 

Then go to your DVD installer of NAV run the setup file.
Select Add or remove components as shown below.


Select Application server and choose run from my computer in the drop down.

Once done, click next and wait until installation is successful.
Now you have Application server installed in your machine.
Go to your local services by searching in start button for services or by just clicking in Run prompt for services.msc. You will see the service installed as shown below.
Logon with your domain account instead of Network service.
Right click on below mentioned server, properties – Logon - > enter your system login id and password.



Now in your start menu, open Application server manager for Microsoft Dynamics NAV.
Right click on application server – select new application server.

Provide the host name – local host
Service name – BHEESHMA-SQL (the name which is displayed in the above marked service.

A new node will be created. Just click on this node and enter details of the server you are using, the database name and company.
To setup job queue the parameter should be JOBQUEUE as described below.


Click on Start the service.
You can check for the active sessions that are running in your machine by running the system table active sessions.
In your NAV development environment go to Database information and select current sessions.
There you must be able to see the new sessions configured as shown in below fig.



Once you verify that NAS service is running start configuring a job queue.


How Job queue works in NAV 2015. 

I explained how to do setup in NAv 2009. In NAV 2015 its pretty easy jus go to your server instance and go to NAS services and give the codeunit and starting method you need to run.

1. To schedule a job queue in NAV 2015 same applies in NAV 2009 R2. In your RTC client, go to Job queue entries click on new.
Choose the report or the codeunit you need to run.


I've given No. of minutes between run as 1 which means for every one minute the report will be run automatically without user interface between the start and end time.

In the above example I've took General Journal - Test report. I have filled the data as shown in above fig. 

Now click on Set status to ready so that now it is ready for job queue. 

2. To run a job queue, go to Job queue card and in NAS Settings, specify  NAS computer  your are using and NAS instance. 
once its done click on start job queue. 

you will get the following warning message.

Start the NAS service.
Once you are done with above steps. The NAS server will internally run the codeunit or the report you mentioned automatically from the specified time.

If it has to be repeated everyday at some specified time. Then mention the date and time it should run in Job Queue Entries page and go to Recurrence fast tab and then select the day and time the codeunit/report should run automatically.