Running a CodeUnit as a service using the Application Server

Hi Guys,

I have a custom CodeUnit which when I run from the Object Designer, displays all available CodeUnits as a webpage to allow them to be interacted with as a webservice, works great.

When I close the Classic Client, it stops working. Reopen, hit Run, starts working again and so on …

My project requires it runs indefinitely regardless if the Object Designer / Classic Client is open, so presume I can use the application server to install it as a service to run in the background?

I have tried the following:

nassql.exe appservername=MyNAVService, NETTYPE=TCP, servername=dynamicsnav2009, database=“Demo Database NAV (6-0)”, company=“CRONUS International Ltd.”, nettype=tcp, startupparameter=“V1Posting”, objectcache=80000, installasservice

V1Posting being the name of the CodeUnit with an ID of 80000.

The service starts great, but it’s not running the CodeUnit / the webpage doesn’t display. Any ideas how I can achieve this?

NOTE: I haven’t made any changes to the V1Posting CodeUnit to accommodate a service which I’m guessing may be the problem.

As always any guidance appreciated. :slight_smile:

Which NAV Version are you using ?

Version here

startupparameter=“V1Posting” should be

startupparameter=“JOBQUEUE”

Then Job Queue needs to be setup.

Hi Pete,

have you added the link in the application management codeuint (1) ?

You need to add in a bit of code into

NASHandler(NASID : Text[260]) function to run your codeunit when nas logs in.

cheers,

Gabor

Fantastic!

Created a JOBQUEUE entry and added the CODEUNIT underneath the standard Mailer and hey presto!

I don’t know what I would do without this forum! [:D]

Great…keep learning…

Nice to read.

You are welcome.

At work we just use an old PentiumII pc and leave it running 24-7 with codeunit turned on.

It’s sole purpose is just to run the codeunit. It’s even on a backup power supply.