Bearbeiten

Freigeben über


Notification.Scope([NotificationScope]) Method

Version: Available or changed with runtime version 1.0.

Specifies the context in which the notification appears in the client.

Syntax

[Scope := ]  Notification.Scope([Scope: NotificationScope])

Note

This method can be invoked using property access syntax.

Parameters

Notification
 Type: Notification
An instance of the Notification data type.

[Optional] Scope
 Type: NotificationScope
The scope in which the notification appears in the client

Return Value

[Optional] Scope
 Type: NotificationScope
The scope of the current notification.

Remarks 1

For more information and a detailed example, see Notifications.

Example 1

The following code creates a notification and sends it in the local scope.

MyNotification.Message := 'This is a notification';
MyNotification.Scope := NotificationScope::LocalScope;
MyNotification.Send;

Remarks 2

The data that is specified by the SetData method can be retrieved by the GetData Method. The SetData and GetData methods are typically used for actions with actions on the notification. The SetData method is called from the source is the notification, while the GetData method is called from the action code.

You can use multiple SetData method calls to specify different data items. The data remains available for the life of the notification instance. The data is cleared once the notification instance has been dismissed or an action is taken.

For more information and a detailed example, see Notifications.

Example 2

The following code sets the data for a notification:

MyNotification.Message := 'This is a notification';
MyNotification.Scope := NotificationScope::LocalScope;
MyNotification.SetData('Created',Format(CurrentDateTime,0,9));
MyNotification.SetData('ID',Format(CreateGUID,0,9));
MyNotification.AddAction('Action 1',CodeUnit::"Action Handler",'RunAction1');
MyNotification.AddAction('Action 2',CodeUnit::"Action Handler",'RunAction2');
MyNotification.Send;

The following code gets the data for a notification:

MyNotification.GetData('Created');
MyNotification.GetData('ID');''

Notification Data Type
Get Started with AL
Developing Extensions''