Monday, March 5, 2012

Running a Process in NAV using NAS and JOB QUEUE


Running a Process in NAV using NAS and JOB QUEUE

Setting NAS

In this tutorial we will run NAS on a SQL Server. Just like with a normal client you can do the same things against a Native server. Just use Nas.exe instead of NasSQL.exe. I assume that you already have a NAV database running on a SQL Server, and that you can open this database with a normal NAV client.
Install NAS from the product CD.
·         Installing NAS will automatically create two services [Machinename-CLASSIC] and [Machinename-SQL] (display name is “Navision Application Server [Machinename]-CLASSIC/SQL”).
·         Remove the two services and add your own service:

For this task, you need to use the command prompt. Go to the folder where you installed NAS. Notice that, in this folder you will find two .exe files: Nas.exe and Nassql.exe. In the following section, use nassql.exe since we are running on a SQL Server. If you were running NAV on Native server, you would use nas.exe. But each file has the same functionality.
Also note, that if you are running on Windows Vista, then opening a normal command prompt may not give you enough permissions. So, if running on Vista, open the command prompt from the Start Menu -> All Programs -> Accessories, then right-click on "Command Prompt", and select "Run as Administrator".

To remove a service, from the command prompt in the NAS folder, type:

Nassql appservername=[machinename]-CLASSIC, uninstallasservice .
This will remove the service with the name [machinename]-CLASSIC that was installed when you installed NAS.
In the same way, remove the [Machinename]-SQL service.

To add a service, type:
  Nassql appservername=NAS, installasservice

·         Go to Application Service Manager


Right Click the Application server for Microsoft Dynamics NAV Manger
Select the service that you have created

Step 1



Step 2


Step 3
Go to administrative toolsà services à give administrator log on password



Step 4
Start the service. To do this you should have administrator permission.  Before you start the service

Step 5
Before you start the service check the setup parameter = JOBQUEUE.
NAS is a client without a user interface (GUI), running as a service. That’s all it is. When it starts, it will run a function in codeunit 1, passing on the Start-up parameter that has been set up. That’s all it does. There are two prerequisites for this function in codeunit 1:
  It must have ID 99 (the name of the function is irrelevant)
  It must have one parameter Text 250. The name of this parameter is also irrelevant.









Step 6 . You can start the service successfully.
How to setup JOBQUEUE inside the Dynamics NAV.
GO to Administration à Job Queueà Job Queue setup and active it.







You can add a new entry to Job Queue Entry. You can run only Reports/Codeunits from Job Queue.
That codeunit or report should not include any GUI like Massages/Error Massages of the process.
You should handle all the possible errors/Massages from C/AL . For example by creating Error Log, Etc.

After you  complete the setup then Reset the status.

You should do only one thing to run the codeunit or Report.
You must pass the Job Queue Entry like below screen shot.

If you have any error in the process you can see the Job Queue error log.

2 comments:

  1. i already do what u said.. but.. im getting this error:

    Te codeunit was called with a Job Queue Entry record. It has no parameters.

    ReplyDelete
  2. Did you check your parameter Job Queue Entry is Var Ticked in the Codeunit??

    ReplyDelete