Navision Timer 1.0'.Timer

Deepankar1982Deepankar1982 Member Posts: 38
Hi,
I want to generate an information message at a specific time so i am using "Navision Timer 1.0'.Timer" automation and to test it i have added the bellow given code on a newly created Codeunit but as per my expectation it's not working so, can anyone help me out & say where i am doing wrong :roll: ...


IF ISCLEAR(NavTim) THEN
CREATE(NavTim);

NavTim.Interval:=10000;
NavTim.Enabled:=TRUE;

Event :NavTim::Timer(Milliseconds:Integer)
Message('Hi');


Deepankar Chanda

Comments

  • reijermolenaarreijermolenaar Member Posts: 256
    Hi,

    Did you already set the SingleInstance property of the codeunit to Yes?
    Reijer Molenaar
    Object Manager
  • Deepankar1982Deepankar1982 Member Posts: 38
    Yes, i did that after going to "Properties" from "View" & thanks for ur quick response.

    Deepankar Chanda
  • reijermolenaarreijermolenaar Member Posts: 256
    When you make change to a single instance codeunit you will have to restart NAV (or reopen the company).
    Reijer Molenaar
    Object Manager
  • Deepankar1982Deepankar1982 Member Posts: 38
    I am afraid to say that, i did that too :cry: ...and yes, i am using Navision 2009 Classic Client.
  • reijermolenaarreijermolenaar Member Posts: 256
    Strange... :-k

    Can you please export your codeunit in textformat and post it here.
    Reijer Molenaar
    Object Manager
  • Deepankar1982Deepankar1982 Member Posts: 38
    Sure Why not....

    OBJECT Codeunit 50021 Nav_Timer
    {
    OBJECT-PROPERTIES
    {
    Date=07/27/09;
    Time=[ 2:52:06 PM];
    Modified=Yes;
    Version List=;
    }
    PROPERTIES
    {
    SingleInstance=Yes;
    OnRun=BEGIN
    IF ISCLEAR(NavTim) THEN
    CREATE(NavTim);

    NavTim.Interval:=6000;
    NavTim.Enabled:=TRUE;
    END;

    }
    CODE
    {
    VAR
    NavTim@1000000000 : Automation "{3B311C81-140E-11D5-8B18-00D0590B4EC5} 1.0:{3B311C92-140E-11D5-8B18-00D0590B4EC5}:'Navision Timer 1.0'.Timer" WITHEVENTS;

    EVENT NavTim@1000000000::Timer@1(Milliseconds@1000000000 : Integer);
    BEGIN
    MESSAGE('hi');
    END;

    EVENT NavTim@1000000000::TimerError@2(ErrorString@1000000000 : Text[1024]);
    BEGIN
    MESSAGE('hi');
    END;

    BEGIN
    END.
    }
    }
  • reijermolenaarreijermolenaar Member Posts: 256
    Sorry, I am out of options.
    The codeunit is working fine in my database...
    Reijer Molenaar
    Object Manager
  • kinekine Member Posts: 12,562
    The NTimer is not working properly when the Business Notification server is installed on the same machine. May be this is the problem...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Deepankar1982Deepankar1982 Member Posts: 38
    Oh ! It's really :-# then i also have no words to frame it ....rather than ](*,) ...lets see, thanks a ton.
  • Deepankar1982Deepankar1982 Member Posts: 38
    edited 2009-08-10
    No, i didn't install business Notification server in my local System....but it's really frowning to me the way it's behaving, u wouldn't believe it's still not working .....
  • kinekine Member Posts: 12,562
    1) How did you run the codeunit?
    2) Have you some other error during this process?
    3) Check your event log for any error
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • krikikriki Member, Moderator Posts: 9,112
    If you do something like this:
    CODEUNIT.RUN(CODEUNIT::"Nav_Timer");
    WHILE TRUE DO BEGIN
      // do something
    END;
    

    The timer will never be triggered.
    In will only be triggered if NAV is waiting for input.

    So, in the NAS, you need to launch the codeunit and then NAV has to go to the end of the function and stop doing something.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Deepankar1982Deepankar1982 Member Posts: 38
    Yessss, it has been Done at last :whistle: Thanks people 4 ur kind & quick support... =D>
  • krikikriki Member, Moderator Posts: 9,112
    Yessss, it has been Done at last :whistle: Thanks people 4 ur kind & quick support... =D>
    And what was the problem (and the solution)?
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Deepankar1982Deepankar1982 Member Posts: 38
    My that piece of code was not running i think due to some NAS error so, i repaired it after running the Navision Setup and after that it worked ..... \:D/
  • Mur1enMur1en Member Posts: 3
    edited 2016-02-23
    https://blogs.msdn.microsoft.com/nav/2015/01/28/timer-usage-in-microsoft-dynamics-nav-2013/ here is timer for navision 2013 + versions how to use timer and probably errors and fix
Sign In or Register to comment.