Freigeben über


SETDATA Function (Notification)

Specifies a data property value for the notification. The data is specified as text in a key-value pair.

Value := SETDATA(Name, Value)

Parameters

Name

Type: Code or text

The text string to use as a unique identifier for the data item.

Value

Type: Code or text

The text string that represents the data.

Return Value

Value

Type: Code or text

The data that was generated by the notification.

Remarks

The data that is specified by the SETDATA function can be retrieved by the GETDATA function. The SETDATA and GETDATA functions are typically used for actions with actions on the notification. The SETDATA function is called from the source is the notification, while the GETDATA function is called from the action code.

You can use multiple SETDATA function 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

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');

See Also

MESSAGE Function(Notification)
SCOPE Function(Notification)
SEND Function (Notification)
ADDACTION Function(Notification)
Notifications