Notification.AddAction(Text, Integer, Text) Method

Version: Available or changed with runtime version 1.0.

Specifies an action for the notification.


 Notification.AddAction(Caption: Text, CodeunitID: Integer, MethodName: Text)


 Type: Notification
An instance of the Notification data type.

 Type: Text
The text string that appears as the caption of the action in the notification UI. The string can be a label that is enabled for multilanguage functionality.

 Type: Integer
The ID of the Codeunit to run when the action is initiated from the notification UI. The codeunit should contain at least one global method to be called by the notification action. The global method must have a Notification data type parameter for accepting the notification object.

 Type: Text
The name of the method in the Codeunit, which is specified by the CodeunitID parameter, that you want to run for the action.


An action provides a way for you to add an interactive notification that enables users to respond to or take action on the notification. The method that is called by the action contains logic that you want to run for the action.

For more information and a detailed example, see Notifications.


The following code creates two actions for a notification. The actions call the RunAction1 and RunAction2 methods in the codeunit Action Handler.

MyNotification.Message := 'This is a notification';
MyNotification.Scope := NotificationScope::LocalScope;
MyNotification.AddAction('Action 1',CodeUnit::"Action Handler",'RunAction1');
MyNotification.AddAction('Action 2',CodeUnit::"Action Handler",'RunAction2');

To handle the actions, the Action Handler codeunit has two global methods that have a Notification data type parameter:

procedure RunAction1@1(MyNotification@1000 : Notification);
    Message('This is RunAction1');

procedure RunAction2@2(MyNotification@1000 : Notification);
 Message('This is RunAction2');

See Also

Notification Data Type
Get Started with AL
Developing Extensions