{"title":"Dialog.Error(Text [, Any,...]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/dialog/dialog-error-string-joker-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/dialog/dialog-error-string-joker-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/dialog/dialog-error-string-joker-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":"Displays an error message and ends the execution of AL code.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Dialog.Error(Text [, Any,...]) Method","slug":"dialogerrortext-any-method","at":0,"chars":2867},{"level":2,"title":"Syntax","slug":"syntax","at":161,"chars":143},{"level":2,"title":"Parameters","slug":"parameters","at":304,"chars":682},{"level":2,"title":"Remarks","slug":"remarks","at":986,"chars":499},{"level":2,"title":"Guidelines for error messages","slug":"guidelines-for-error-messages","at":1485,"chars":448},{"level":2,"title":"Example","slug":"example","at":1933,"chars":627},{"level":2,"title":"Related information","slug":"related-information","at":2560,"chars":307}],"text":"# Dialog.Error(Text [, Any,...]) Method\n> Version: _Available or changed with runtime version 1.0._\nDisplays an error message and ends the execution of AL code.\n## Syntax\n```al\n Dialog.Error(Message: Text [, Value: Any,...])\n```\n> NOTE\n> This method can be invoked without specifying the data type name.\n## Parameters\nMessage\nType: ../text/text-data-type\nThis string contains the text of the error message you want to display to the user. Use percent signs (%) or number signs (#) to insert variable values into the string. Place the percent or number signs where you want to substitute the variable value. The string can be a label that is enabled for multilanguage functionality.\n*[Optional] Value*\nType: ../any/any-data-type\nAny variable or expression to be inserted in String. You can insert up to 10 values. For '#'-type fields, the value is truncated according to the total number of number-sign characters in String. For '%'-type fields, the full length of the value is printed.\n## Remarks\nThe window is automatically sized to hold the longest line of text and total number of lines. By calling the method with an empty string the execution of AL code ends without displaying a message.\n> NOTE\n> Consider using the newer version of the Dialog.Error method dialog-error-errorinfo-method to use many of the newer features in error dialogs, such as (hidden) detailed error messages for the person who needs to troubleshoot, error message titles, and support for actionable errors.\n## Guidelines for error messages\nImproving error handling and error messages reduces friction for the users and highly impacts the user experience. Clear and informative error messages help users understand what went wrong and how to correct it, which reduces frustration, and improves user satisfaction.\nFor guidance on how to formulate good error messages, see Error message best practices - what to say?<../../devenv-error-handling-guidelines>.\n## Example\nThis example shows how to use the Error method.\n```al\nvar\n    AccountNo: Integer;\n    Text000: Label 'Finance Account #1#### must not be blocked.';\n    Text001: Label 'Placeholder message.';\nbegin\n    AccountNo := 1230;\n\n    // The execution stops when the error statement is executed\n    // and all following statements will never be executed.\n    Error(Text000, AccountNo);\n\n    Message(Text001); // This line is not executed.\nend;\n```\nThe error window displays the following:\nFinance Account 1230 must not be blocked.\nThe Error method causes execution of AL code to stop. dialog-message-method is never executed.\n## Related information\ndialog-error-errorinfo-method\nError handling overview<../../devenv-al-error-handling>\nAnalyzing Error method telemetry<../../../administration/telemetry-error-method-trace>\ndialog-data-type\nGet started with AL<../../devenv-get-started>\nDeveloping extensions<../../devenv-dev-overview>"}