{"title":"Notification.AddAction(Text, Integer, Text) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/notification/notification-addaction-string-integer-string-method/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/notification/notification-addaction-string-integer-string-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/notification/notification-addaction-string-integer-string-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Specifies an action for the notification.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Notification.AddAction(Text, Integer, Text) Method","slug":"notificationaddactiontext-integer-text-method","at":0,"chars":2305},{"level":2,"title":"Syntax","slug":"syntax","at":155,"chars":98},{"level":2,"title":"Parameters","slug":"parameters","at":253,"chars":797},{"level":2,"title":"Remarks","slug":"remarks","at":1050,"chars":328},{"level":2,"title":" Example","slug":"example","at":1378,"chars":783},{"level":2,"title":"Related information","slug":"related-information","at":2161,"chars":144}],"text":"# Notification.AddAction(Text, Integer, Text) Method\n> Version: _Available or changed with runtime version 1.0._\nSpecifies an action for the notification.\n## Syntax\n```al\n Notification.AddAction(Caption: Text, CodeunitID: Integer, MethodName: Text)\n```\n## Parameters\nNotification\nType: notification-data-type\nAn instance of the notification-data-type data type.\nCaption\nType: ../text/text-data-type\nThe 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.\nCodeunitID\nType: ../integer/integer-data-type\nThe 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.\nMethodName\nType: ../text/text-data-type\nThe name of the method in the Codeunit, which is specified by the CodeunitID parameter, that you want to run for the action.\n## Remarks\nAn 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.\nFor more information and a detailed example, see ../../devenv-notifications-developing.\n##  Example\nThe following code creates two actions for a notification. The actions call the RunAction1 and RunAction2 methods in the codeunit Action Handler.\n```al\nMyNotification.Message := 'This is a notification';\nMyNotification.Scope := NotificationScope::LocalScope;\nMyNotification.AddAction('Action 1',Codeunit::\"Action Handler\",'RunAction1');\nMyNotification.AddAction('Action 2',Codeunit::\"Action Handler\",'RunAction2');\nMyNotification.Send();\n```\nTo handle the actions, the Action Handler codeunit has two global methods that have a Notification data type parameter:\n```al\nprocedure RunAction1(MyNotification : Notification);\nbegin\n    Message('This is RunAction1');\nend;\n\nprocedure RunAction2(MyNotification : Notification);\nbegin\n    Message('This is RunAction2');\nend;\n```\n## Related information\nnotification-data-type\nGetting Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}