onTimer with new Navigation Pane

In Navision 3.x we had the possibility to use the onTimer trigger on the main form so evey user session was sure to execute the code there. In Navision 4.x there is no single form that EVERY user has to open when starting his session. Is there a way to have code executed nevertheless by every session? Maybe within the Navigation Pane somewhere?

I have not tried it, but I would put such code in Codeunit 1 (e.g. the function LogInStart). That should get your code executed. regards Daniel

Hi Daniel, thanks for your response. The function needs to be executed regularly (every 30 sec). I am not sure whether you can time code in CU1?!

You could run a single instance codeunit from CU 1. Since it’s not a form there is no OnTimer trigger, but you could use one of the timer DLL’s that ship with Navision.

Create a global variable of the type Automation and call it timer, change the property “WithEvents” to Yes for that variable. Select “‘Navision Timer 1.0’.Timer” for the subtype of your variable You shoud find 4 functions in the CU then: Documentation() OnRun() Timer::Timer(Milliseconds : Integer) Timer::TimerError(ErrorString : Text[1024]) Add this code to your OnRun trigger CREATE(Timer); Timer.Interval := 30000; // 30 sec * 1000 = 30000 msec Timer.Enabled := TRUE; You just need to run this CU once and you will see that the Timer::Timer(…) function is getting called every thirty seconds and you can call any code you want in there. Do not forget to change the SingleInstance property of the CU to Yes. When you change code in a SI CU do not forget to close and reopen the company to let navision forget the “old” code as it is still active in the memory and still shooting every 30 sec with the old code.