run codeunit in scheduled task

Hi everybody,

First post for me here so “Hello World!”.

I’m a newbie in Navision, I use 3.7 Client/Side in one of our client environment. We managed to script a codeunit that extracts several dataport in CSV files.

Now I’m looking for scheduling this codeunit. I saw many posts related to NAS but only one with a batch script, which is exactly what we needed:

Now my problem is that the authentication used in the production server is Database Server Authentication, so I should use a similar logic in my command:

“C:\Program Files\Microsoft Business Solutions-Navision\Client\fin.exe” database=“C:\MyNavDB.fdb”,compaNavisionny=“MyCompany”, userID=user, pass=pass, object=codeunit, id=50500

But nor user (nor userid) seems to exist. In the post above, rchurchil used a id but it is a bit strange for me. Is it the name of the object? If yes how can Navision knows that it is a codeunit or any other object?

Any help on this wiill be highly appreciated.

NAS can only do windows authenication, so you need to change your sql to mixed mode. Add a windows user in nav. and then run the NAS has that windows user.

Thanks for your quick answer, I will use the windows authentication, because indeed I can’t log in as a database user

Now I still dont understand rchurchil’s command in his post (see original post above). He used an id=370auto. What is it? and iff it’s the codeunit name how Navision can understandit is a codeunit object?

I tried to do it with this command, I log in as my windows account but then nothing happened:

“C:\Program Files\Microsoft Business Solutions-Navision\Client\fin.exe” id=50500,database=“C:\db.fdb”,nettype=TCP,company=“MyCompany”,ntauthentication=yes

My code unit is the object number 50500 and is name NAVEXTRACT

Thanks for you help


id=50500 means that Navision will use zup file 50500.ZUP

Database authentication should work too, because you are not running NAS.

From rchurchil’s post I understand that he added code to codeunit 1. I think he added if statement to CompanyOpen function:

IF USERID = ‘youruserid’ THEN CODEUNIT.RUN(…);

Why don’t you use Job Scheduler?

humm is there a job scheduler in Nav 3.7?

Yes it is, but you need to have special granule from service management area.