{"title":"Dialog.Open(Text [, var Any,...]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/dialog/dialog-open-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-open-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-open-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":"Opens a dialog window.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Dialog.Open(Text [, var Any,...]) Method","slug":"dialogopentext-var-any-method","at":0,"chars":3638},{"level":2,"title":"Syntax","slug":"syntax","at":126,"chars":149},{"level":2,"title":"Parameters","slug":"parameters","at":275,"chars":851},{"level":2,"title":"Remarks","slug":"remarks","at":1126,"chars":1080},{"level":2,"title":"Example 1","slug":"example-1","at":2206,"chars":624},{"level":2,"title":"Example 2","slug":"example-2","at":2830,"chars":674},{"level":2,"title":"Related information","slug":"related-information","at":3504,"chars":134}],"text":"# Dialog.Open(Text [, var Any,...]) Method\n> Version: _Available or changed with runtime version 1.0._\nOpens a dialog window.\n## Syntax\n```al\n Dialog.Open(String: Text [, var Variable1: Any,...])\n```\n> NOTE\n> This method can be invoked without specifying the data type name.\n## Parameters\nDialog\nType: dialog-data-type\nAn instance of the dialog-data-type data type.\nString\nType: ../text/text-data-type\nThis string contains the text that you want to display in the window. Use a backslash (\\\\) to start a new line. Use number signs (#) to insert variable values into the string. Place the number signs where you want to substitute the variable value. Place a number in the part of the string where a variable value will be substituted (for example, #1####) to be able to reference this field for updating. The number of # characters in the string indicates the length of the field. You can update the fields using the UPDATE method (Dialog) or by letting the user edit the values.\n*[Optional] Variable1*\nType: ../any/any-data-type\nUse these optional parameters to specify variables for field1, field2, and so on in the String.\n## Remarks\n> NOTE\n> The use of a backslash (`\\`) to initiate a new line is not applicable to progress dialogs that are displayed during the Generation or Regeneration process of a PromptDialog page. See ../../devenv-page-type-promptdialog.\nDialog windows that are opened by an object are closed when the object terminates.\nDialog windows are automatically sized to hold the longest line of text and the total number of lines.\nWe recommend the following guidelines:\n Enter messages as text constants.\n Write messages using active voice. For example, write \"Processing items\" instead of writing \"Items are being processed.\"\n Align the \\# field to the left with at least one space character between the text and the variable.\n> NOTE\n> With the Dynamics NAV Client connected to Business Central, you can use @ characters instead of # characters for the String parameter to display the value as percentage and a progress indicator. The percentage value that is displayed is the percentage of the variable value from 0 to 9999. This is not supported in the Business Central Web client.\n## Example 1\nThis example shows how to use the dialog.Open method.\n```al\nvar\n    MyDialog: Dialog;\n    MyNext: Integer;\n    Text000: Label 'Counting to 4 #1:';\nbegin\n    MyNext := 0;\n    MyDialog.Open(Text000,MyNext);\n    repeat\n      // Do some processing.\n      Sleep(1000);\n      MyNext := MyNext + 1;\n      MyDialog.Update(); // Update the field in the dialog.\n    until MyNext = 4;\n    Sleep(1000);\n    MyDialog.Close();\nend;\n```\nThe dialog window opens and displays this text:\nCounting to 4: 0\nEvery one second, the dialog window updates with the new value of MyNext until it reaches 4, then the dialog window closes.\n## Example 2\nThis example shows how to use the dialog.Open method to display a progress indicator in the Dynamics NAV Client connected to Business Central. The progress indicator will not display in the Business Central Web client.\n```al\nvar\n    MyDialog: Dialog;\n    MyNext: Integer;\n    Text000: Label 'Progress from 0 to 9999 #1#####';\nbegin\n    MyNext := 0;\n    MyDialog.Open(Text000,MyNext);\n    repeat\n      // Do some processing.\n      MyNext := MyNext + 1;\n      MyDialog.Update(); // Update the field in the dialog.\n    until MyNext = 9999;\n    Sleep(1000);\n    MyDialog.Close();\nend;\n```\nThe dialog window opens and displays the progress indicator and percentage.\n## Related information\ndialog-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}