Question

I am facing some problem regarding running an object , can be form,report etc, automatically depending on the user defined time. Let us say at 6am everyday, a process report should run automatically.

How can i achieve this?

Was it helpful?

Solution

I have found a Solution for me.. This example runs at 7:40, 12:40 and 16:40 each day.

  1. Using the Navision Timer 1.0 NAVTimer Automation 'Navision Timer 1.0'.Timer

  2. Set the Property 'WithEvents' of the NAVTimer to Yes

    Set the Property 'SingleInstance' of the Codeunit, if you using one, to Yes

  3. In the On Run Trigger write

IF ISCLEAR(NAVTimer) THEN CREATE(NAVTimer);

NAVTimer.Interval := 1 * 60000;  // Important! set to 1 Minute     

NAVTimer.Enabled := TRUE;

In the Timer Trigger (it appers after you change WithEvents Property to Yes) write

sTime := COPYSTR(FORMAT(TIME), 1, 5); // Cut seconds
sHour := COPYSTR(sTime, 1, 2);
sMinute := COPYSTR(sTime, 4, 2);
IF sHour IN ['07','12','16'] THEN
  IF sMinute = '40' THEN
    IF NOT CODEUNIT.RUN(CODEUNIT::xxx) THEN;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top