When still working in Dynamics NAV, you can easily add a timer to your page to allow, for instance, refreshes of the page in intervals. For that, you could use a Control Add-In called “Ping Pong”. Since we have no ability to use .Net anymore in AL, this ability went away and was not replaced with anything new yet.

While we have suggested already a different implementation to make this functionality available on all pages by default, it is not decided, if anything will be done. So, for now, we are stuck without the ability to update the page content on a periodic basis.

We can, however, create our own user control and rewrite the Ping Pong functionality. It only takes a few minutes to do:

Create a new user control in your project:

controladdin MyPingPong
    Scripts = 'js/MyPingPong.js';

    StartupScript = 'js/MyPingPongMain.js';

    HorizontalShrink = true;
    HorizontalStretch = true;
    MinimumHeight = 1;
    MinimumWidth = 1;
    RequestedHeight = 1;
    RequestedWidth = 1;
    VerticalShrink = true;
    VerticalStretch = true;

    procedure SetTimerInterval(milliSeconds: Integer);

    procedure StartTimer();

    procedure StopTimer();

    event ControlAddInReady();

    event PingPongError();

    event TimerElapsed();

Then add a new folder called “js” and place two new files in the folder.

File 1: MyPingPongMain.js:


File 2: MyPingPong.js

"use strict"

var timerInterval;
var timerObject;

function initializeControlAddIn(id) {
    var controlAddIn = document.getElementById(id);

    controlAddIn.innerHTML =
		'<div id="my-ping-pong">' +

	Microsoft.Dynamics.NAV.InvokeExtensibilityMethod('ControlAddInReady', null);

function pageLoaded() {

function SetTimerInterval(milliSeconds) {
    timerInterval = milliSeconds;

function StartTimer() {
    if (timerInterval == 0 || timerInterval == null) {
        Microsoft.Dynamics.NAV.InvokeExtensibilityMethod('PingPongError', ['No timer interval set.']);

    timerObject = window.setInterval(ExecuteTimer, timerInterval);

function StopTimer() {

function ExecuteTimer() {
    Microsoft.Dynamics.NAV.InvokeExtensibilityMethod('TimerElapsed', null);

That’s it. Now you can add the user control to any page, as seen below in a page extension

pageextension 50000 "MyPingPong" extends "Customer Card"
                ApplicationArea = Basic;

                trigger TimerElapsed()
                    Message('timer elapsed');

    trigger OnAfterGetCurrRecord()

You will see that you will get a message shown every 2 seconds (the timer interval is in milliseconds). It is important to stop the timer when the timer has elapsed (trigger TimerElapsed) so that the timer is not trying to raise a new event while the message is still shown.

Obviously, you can add any code you want in the body of the TimerElapsed trigger.


This code does not have extensive error handling and is not quality controlled. You are going to use this code as a sample only and at your own risk. Support is not provided for this user control.