Job Queue for Unlimited Company

AdministratorAdministrator Member, Moderator, Administrator Posts: 2,500
edited 2013-11-13 in Download section
Job Queue for Unlimited Company
The Job Scheduler 4.0 has been replaced in in 5.0 by Job Queue. You can use Job Queue to schedule to run reports, Codeunits, as adjust cost. Job Queue uses NAS to run the job. As you might know NAS can only run for one company. Thus if you have multiple companies, you need one instance of NAS per Company. The following modification allows you to run Job Queue in unlimited companies. Using two license instances of NAS. You only need to install one NAS. The code run NAS itself as second instance connecting to different companies. The only difference Setup wise is the new field "Company Name" in Job Queue Entry Code, where you can select other Companies.

You could run with one instance of NAS and a Navision client, by running CU 448 directly from a client where NAS is installed. NAS service should be stopped. NAS uses windows authentication so make sure have windows authentication.

Feedback is welcome.
Enjoy.

http://www.mibuso.com/dlinfo.asp?FileID=924

Discuss this download here.
«134

Comments

  • alwaysgunaalwaysguna Member Posts: 45
    Hi,

    I just wanted to know whether this download can be used in Nav 4.0 Sp3.

    Regards,
    Guna
    Guna
  • najjanajja Member Posts: 67
    Mr. Guna,

    Why dont you try it yourself and let others know.

    Najja
  • danlindstromdanlindstrom Member Posts: 130
    BlackTiger:
    The big difference between you and ara3n (Rashed) is that Rashed shares his solution to the community =D> and that you only says that you have made a solution.
    Regards
    Dan Lindström
    NCSD Navision 2.00 since 1999 (Navision Certified Solution Developer)
    MBSP Developer for Microsoft Dynamics NAV 2009
  • FeldballeFeldballe Member Posts: 26
    I took a swift look into the file: "Changes.txt". If NAS is supposed to run this codeunit my guess would be, that you should place all Mesages in a GUIALLOWED context.
    The NAS cannot react on GUI-based messages - or is this possible in NAV 5.0 using GetLastError?

    Otherwise a very interesting concept :D
  • ara3nara3n Member Posts: 9,256
    BlackTiger wrote:
    Question... How about NAS client licenses if you're executing job for other company?

    You'll need 2 NAS client licenses.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ara3nara3n Member Posts: 9,256
    alwaysguna wrote:
    Hi,

    I just wanted to know whether this download can be used in Nav 4.0 Sp3.

    Regards,
    Guna

    You need 5.0 executables. Because I'm using getlasterrortext function
    as well as CurrentDirectory function.

    You can take job queue object and move them to 4.0 db. They are self contained.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ara3nara3n Member Posts: 9,256
    BlackTiger wrote:
    No! It's not my work! Camel notation in code! What could be worse...


    Variables such as WasSuccess are used by Navision CU Job Queue Dispacher.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ara3nara3n Member Posts: 9,256
    edited 2007-12-11
    BlackTiger wrote:
    Looks like somebody stolen my work... idea... I've implemented job queue for NAV long time ago. I have proven many times what "Job Queue" is much better than plain "Job Rotator".

    Well there are other solution out there.
    Plus there are several threads about running nas in multiple companies.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ara3nara3n Member Posts: 9,256
    BlackTiger wrote:
    ara3n wrote:
    BlackTiger wrote:
    No! It's not my work! Camel notation in code! What could be worse...


    Variables such as WasSuccess are used by Navision CU Job Queue Dispacher.

    It's Pascal notation. NAV's style.

    But vars named as "txtSomeVariable" is Hungarian notation. Awful style. I was wrong about Camel notation ("someVariable"). But both are not in NAV coding style.

    There are only two variable that I used Hungarian notations. I don't like them either. I don't use them.
    I was trying to make it easier to read.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • danlindstromdanlindstrom Member Posts: 130
    ara3n wrote:
    BlackTiger wrote:
    Question... How about NAS client licenses if you're executing job for other company?

    You'll need 2 NAS client licenses.

    Do you mean sessions (like granule 1200) or instances (granule 1415)?
    Regards
    Dan Lindström
    NCSD Navision 2.00 since 1999 (Navision Certified Solution Developer)
    MBSP Developer for Microsoft Dynamics NAV 2009
  • ara3nara3n Member Posts: 9,256
    granule 1415

    Navision already comes with 1 free NAS.

    You need to only purchase 1 additional granuale 1415.


    Also you need 3,810 Job Queue (ver 5.0 or later only) if you haven't had job scheduler.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ronvdwronvdw Member Posts: 16
    Did you try this solution in combination with windows vista?
    Connectivity Studio for Microsoft Dynamics NAV - Where Microsoft Dynamics NAV meets the world
  • danlindstromdanlindstrom Member Posts: 130
    ara3n wrote:
    alwaysguna wrote:
    Hi,

    I just wanted to know whether this download can be used in Nav 4.0 Sp3.

    Regards,
    Guna

    You need 5.0 executables. Because I'm using getlasterrortext function
    as well as CurrentDirectory function.

    You can take job queue object and move them to 4.0 db. They are self contained.

    You are also using the new SQL-table 'Server' (new in 5.0 and only in SQL)
    It can be used in Nav4 if you removes/rewrites the errorhandling and move the parameter read from the server-table to another existing table
    Regards
    Dan Lindström
    NCSD Navision 2.00 since 1999 (Navision Certified Solution Developer)
    MBSP Developer for Microsoft Dynamics NAV 2009
  • ara3nara3n Member Posts: 9,256
    ronvdw wrote:
    Did you try this solution in combination with windows vista?

    No I have not. I don't have vista. The way it looks like, most companies will be skipping vista and move to Windows 7 when it comes.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • RachelSoonRachelSoon Member Posts: 202
    ara3n wrote:
    alwaysguna wrote:
    Hi,

    I just wanted to know whether this download can be used in Nav 4.0 Sp3.

    Regards,
    Guna

    You need 5.0 executables. Because I'm using getlasterrortext function
    as well as CurrentDirectory function.

    You can take job queue object and move them to 4.0 db. They are self contained.

    Hi Ara3n,
    I am importing the job queue objects into NAV4.0, SP2. I am taking the Job queue object as the customise object, meaning i change the object to 50000 series. I skip the coding for codeunit 1 as it involve the license agreement.

    The objects are fine so far, except the function "GETLASTERRORTEXT" and "WindowShell.CurrentDirectory(ApplicationPath)".

    Do you have any idea about replacing the above functions in NAV4 SP2?

    Kindly advise.

    Thank you.

    Regards
    Rachel
  • ara3nara3n Member Posts: 9,256
    This function was introduced in 5.0.

    You need to do an exe upgrade and use the 5.0 executables.

    If you can't use the 5.0 exe for some reason, you can change it to just write just a generic error. "Error during processing."
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • RachelSoonRachelSoon Member Posts: 202
    ara3n wrote:
    This function was introduced in 5.0.

    You need to do an exe upgrade and use the 5.0 executables.

    If you can't use the 5.0 exe for some reason, you can change it to just write just a generic error. "Error during processing."

    Hi ara3n,
    thank you for the prompt reply. Yes, i can not upgrade to 5.0 exe. The client is not ready for 5.0 at the moment.

    what about "WindowShell.CurrentDirectory(ApplicationPath)"? What is the directory that should refer to?

    Thank you.

    Regards
    Rachel
  • ara3nara3n Member Posts: 9,256
    Just want to make sure you know the difference between exe upgrade and a full upgrade.

    The ApplicationPath is also a 5.0 variable. It returns where the current program is running from.

    Basically where is NAS installed. So basically NAS runs it's own copy based on where it's running (installed) from


    You can changed it to a setup, or harcod C:\program files\Microsoft Business Solution\Application Server\
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • RachelSoonRachelSoon Member Posts: 202
    Hi ara3n,
    Yes, i understand about the difference between the exe and full upgrade. But we recently just upgrade the from NAV4 SP2 to NAV4 SP3. And i dont think i will propose to upgrade to NAV5 for this. My client involve LAN and WAN users...

    OK, i will do a setup for the "current directory".

    Thank you very much for your advise. I will try it out.

    Regards
    Rachel
  • RachelSoonRachelSoon Member Posts: 202
    Hi ara3n,
    I have 2 queries :
    1) In the codeunit "Run NAS Accoss Company", there is a variable "strParamemter". Where is this parameter will be passed in?

    2) How can i trigger the job queue for multiple company? is that mean in the main company book, i use the job scheduler to trigger the codeunit "Run NAS Accoss Company"?

    Thank you.

    Regards
    Rachel
  • ara3nara3n Member Posts: 9,256
    RachelSoon wrote:
    Hi ara3n,
    I have 2 queries :
    1) In the codeunit "Run NAS Accoss Company", there is a variable "strParamemter". Where is this parameter will be passed in?

    Add the following to CU 1
    END;
      //MOD01 Start
      IF (COPYSTR(Parameter,1,9) = 'JOBQUEUE2') THEN BEGIN
          CU50000.SetParameter(Parameter);
          CU50000.RUN;
          CGNASStartedinLoop := TRUE;
      END;
      //MOD01 End
      IF CGNASStartedinLoop = FALSE THEN
    

    This is where it's called.

    RachelSoon wrote:
    2) How can i trigger the job queue for multiple company? is that mean in the main company book, i use the job scheduler to trigger the codeunit "Run NAS Accoss Company"?

    yes In main company you will setup Job Scheduler. You'll have a new field Company Name in there. And call My new codeunit which will start 2nd NAS for the other companies.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • RachelSoonRachelSoon Member Posts: 202
    Hi ara3n,
    I have added the code to CU1 as per your advice.

    However, i am unable to trigger the job at the main company. Below is the setup at the MAIN company:

    1) at "Job Queue Entry Card", i setup to run a report 50000 for company A and company B. The status for the entry is defaulted to "On Hold"

    2) at "Job Scheduler Setup" (F6091), i setup the CU "Job Queue Start Codeunit".

    When the time the job has been trigger, the system does not proceed to run the job. The message is as below : The job scheduler stopped due to an error. The program has moved the job to the next run date and time.

    Is there anything that i setup wrong?

    Thank you.

    Regards
    Rachel
  • ara3nara3n Member Posts: 9,256
    turn on the debugger and see where it stops.
    I'm guessing you are moving job queue to 4.0 database?

    I suggest to first do the test in a 5.0 exe so that you can see the error and learn how it works, then move it to 4.0.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • RachelSoonRachelSoon Member Posts: 202
    Hi ara3n,
    Yes, you are right. I move the job queue to NAV4.

    OK. will try your suggestion.

    Thank you.

    Regards
    Rachel
  • RachelSoonRachelSoon Member Posts: 202
    Hi ara3n,
    I have tried the NAV 5 standard, the job queue work fine. Then i imported the objects for job queue for unlimited company.

    The job got triggered and executed fine if WIHTOUT assigning the company name at the "Job Queue Entry Card".

    Once assign the company name, the job (to run a report) got started by prompting a blank command prompt window with the current directory at the title bar.
    The report suppose to update some information at the customer card, however, nothing has been updated.

    Is there anything wrong / setup that i have missed out?

    Kindly advise.

    Thank you.

    Regards
    Rachel
  • RachelSoonRachelSoon Member Posts: 202
    HI ara3n,
    Any advices on the problem that i posted on May 29?

    We are running out of idea what to do next.

    you advice is highly appreciated. thank you.

    Regards
    Rachel
  • ara3nara3n Member Posts: 9,256
    Hello Rachel.

    Sorry I had not read your may 29 post. I will take a look at it this by next week.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • RachelSoonRachelSoon Member Posts: 202
    Hi ara3n,
    Thank you very much.
    We are really running out of idea how to solve it.

    Regards
    Rachel
  • HusaHusa Member Posts: 1
    Great piece of code.
    You saved me a heap of time.
    Works like a charm.

    I adapted to work with V4SP3 without having to use the Job Queue.
  • RemcoRemco Member Posts: 81
    Hi,

    Question:
    I see that the StartUpparameter is configured as follows:
    JOBQUEUE2|'+COMPANYNAME+'|'+FORMAT(JobQueueEntry.ID);

    My question:
    I understand that I need to install a NAS. Do I also need to setup a NAS-client. And if I do, with what StartUpParameter should I set up this NAS-client.
    Because the StartUpParameter created in this functionality is different every time.
    :)
Sign In or Register to comment.