Notifications have been around in Business Central for some time now. They are a really good non-intrusive way to make processes easier for users. In this post, I will introduce how notification actions can be used to interact with the notification. Letting the users decide when do they want to complete the task.

In the example below, we will remind the user to fill the ‘Ship-to Adress’ table when creating a new customer and let them decide when do it.

Calling Event

First we need to identify where do we want the notification to be sent to the user. In this case it will be the ‘OnAfterInsert’ event of the Customer table.

Notification Function

We will build the notification as the following:

  1. Write the message.
  2. Choose the scope of the notification.
  3. Set the data for the Action. This is needed when calling the action procedure.
  4. Add the action. Call the action procedure by choosing where the function is and the name of it. Note that it has to be in plain text.
  5. Send the notification.

Notification Action

The notification action procedure will check if the notification has any data (HasData), retrieve that data and use it to open the desired page. In this example we want the open the ‘Ship-to Address’ list of the customer we are creating:

As mentioned, the ‘OpenShipToAddress’ procedure has no references as it is called in this specific way:

procedure SendNotification(Rec: Record Customer)
    xlNotification: Notification;
    xlNotification.Message('Don´t forget to add Ship-to Address');
    xlNotification.Scope := xlNotification.Scope::LocalScope;
    xlNotification.SetData('ShipTo', Rec."No.");
    xlNotification.AddAction('Open Ship-to Address List', Codeunit::Functions, 'OpenShipToAddress');

procedure OpenShipToAddress(pNotification: Notification)
    Customer: Record Customer;
    rlShipToAddress: Record "Ship-to Address";
    plShipToAddress: Page "Ship-to Address List";
    if pNotification.HasData('ShipTo') then begin
        rlShipToAddress.SetRange("Customer No.", Customer."No.");

Let´s try it out in this short clip:

That´s all. Hope you find it useful.

How To Create Notification Actions In Business Central

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *