NAS SingleInstance behaviour when called from a page

MiguelCostaMiguelCosta Member Posts: 4
edited 2015-05-29 in NAV Three Tier
Hi All

I've got a codeunit 50001 that is started with NAS and JOBQUEUE.
This codeunit has functions to init a variable 'Start' to TRUE or FALSE and it messages to event viewer in windows that variable:

OnRun()
DoIt;

DoIt()
MESSAGE('DoIt %1',Start);

StartON()
Start:=TRUE;
MESSAGE('Started:%1',Start);

StopOff()
Start:=FALSE;
MESSAGE('Stopped:%1',Start);

setBool(Bool : Boolean)
Start:=Bool;

getBool() : Boolean
EXIT(Start);


Then I've got a PAGE that has a button to call the StartON() function to init the 'Start' to TRUE.

If I go to the PAGE an hit the button to call the StartON() function imodifies the 'Start' to TRUE.

If I open other page similar to this one that has call for the function getBool() it says 'YES', so the single instance codeunit is working between pages. The 'Start' is set to 'YES' because I set it TRUE on first PAGE.

But in the EventViewer triggered by NAS I can see every minute events with the 'DoIt NO'.

Resuming: The singleInstace codeunit works fine but for some reason NAS seems to catch other instance of the same codeunit.
Can someone hep me?

Thanks

Miguel Costa

Comments

  • BardurKnudsenBardurKnudsen Member, Microsoft Employee Posts: 137
    The single instance codeunits are per user session, i.e. two different users will not see each other's single instance codeunits. And the NAS is a separate user instance and can hence not see the other sessions' single instance codeunits.
    In order to obtain what you want here, you will need a database table to store the global values.
    Bardur Knudsen
    Microsoft - Dynamics NAV
  • MiguelCostaMiguelCosta Member Posts: 4
    Thanks Bardur Knudsen.
Sign In or Register to comment.