The new PingPong add-in for NAV 2013

In NAV 2009 I used a custom control add-in to enable timers in the Role Tailored Client.  NAV 2013 ships with a control add-in that is called PingPong.  In upgrading one of my solution to NAV 2013 I wanted to remove the custom control and introduce the PingPong instead.


The control requires a name and as the standard functionality does I use the name PingPong.  The code I had in the – OnControlAddin trigger is now moved to a new trigger, PingPong::Pong.  The new timer does not work the same way the old one does.  The method used is similar to the new method in the Job Queue where the sleep function is used instead of a regular timer.  By executing Currpage.PingPong.Ping(500) a new thread is started that sleeps for 500 milliseconds and then fires the trigger PingPong::Pong.  Hence the add-in name.  When all required code in this trigger has been executed another Ping is required to thow the next ball.


This is all good if the application is only using one timer.  I saw that if I already had one PingPong working then in the subsequent page PingPong did not work.  The good news is that the timer control add-in that I created for NAV 2009 also works in NAV 2013.  The page that I open from the page running PingPong will continue to use the timer add-in that originated from Freddy and I changed a little bit.

22 Replies to “The new PingPong add-in for NAV 2013”

  1. Hi Gunnar,
    Thanks for your example.
    I have a problem using the PingPong Add-in maybe you can help me.
    I want to display on a list page a field “Time Left” (type duration) which looks like a count to zero (HH:MM:SS). So i want to refresh my page each second using the pingpong add-in.
    Is it possible ?

    1. Sure it is possible. Should be something like this.


      TimeLeft := TimeLeft – 1000;

  2. I tried something like this but unsuccessfully !
    My page is temporary and i fill it when i open the page (OnOpenPage trigger)
    Here the function “Fct_UpdatePage” called in the trigger:

    //>>begin function
    RecGServiceHeader.SETRANGE(“Document Type”,RecGServiceHeader.”Document Type”::Order);
    IF RecGServiceHeader.FINDSET THEN
    “Time Left” := Fct_CalcTimeLeft;
    UNTIL RecGServiceHeader.NEXT = 0;

    SETCURRENTKEY(“Time Left”);
    //<<end function

    And this the code in the add-in triggers



    what's wrong ? 🙁

    1. Are you trying to update the whole page, not just a global variable that you display on the page ?
      If that is the case you will need to emulate F5 being pusshed twize.

      For example with a function


      SendKey(Key : Text[30])
      Wait := TRUE;

      where WShell is Automation ‘Windows Script Host Object Model’.WshShell

  3. No only the Time Left field i want to update.
    But nothing happened ! for the moment the only solution i have it is to add a button which run my function “UpdatePage” when i press on.

      1. Is your timer Add – in supported in the the WEB Client ?? DO you know of one to use if yours is not supported ? Thanks

      1. Thank you Gunnar, i have another question, does ping pong use server ram? it seems that the page running ping pong does not free up the RAM. over time the application server’s ram grew to nearly 21GB.

        have you had such experience?

  4. Has anyone noticed if you start a Page with RUNMODAL the PingPong never activates?
    i.e. MyPingPongPage.RunModal; walking through the code you can see the Addon activate, but it never fires.. Changing the above to MyPingPongPage.Run; everything works fine.
    I need the RunModal to work, as I don’t want the user straying from that page..

  5. Hi Gunnar,

    Why did you add a PingPong Field to a Page? I did the same thing but was unable to select the PingPong assembly in the ControllAddIn Property of the page. Do I have to add the PingPong assembly as a Global Variable too? Thanks in advance.

  6. We’ve used pingpong previously in NAV2013,NAV2016 is there an issue with using pingpong in NAV2017 to refresh cue controls linked to flowfields in role centers? They no longer seem to refresh. Only if place CurrPage.ACTIVATE(TRUE) but then z-order of any open pages is changed.

    Thank you



  7. This is absolutely remarkable. I’ve been looking for a replacement for the OnTimer trigger forever. I’m incredibly grateful for this post. I tried it out and it works exactly as advertised. Thank you, Gunnar!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.