{"title":"Page.RunModal(Integer [, Record] [, Any]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/page/page-runmodal-integer-table-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/page/page-runmodal-integer-table-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/page/page-runmodal-integer-table-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":"Creates, opens, and closes a page that you specify.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Page.RunModal(Integer [, Record] [, Any]) Method","slug":"pagerunmodalinteger-record-any-method","at":0,"chars":2557},{"level":2,"title":"Syntax","slug":"syntax","at":284,"chars":99},{"level":2,"title":"Parameters","slug":"parameters","at":383,"chars":718},{"level":2,"title":"Return Value","slug":"return-value","at":1101,"chars":115},{"level":2,"title":"Remarks","slug":"remarks","at":1216,"chars":1209},{"level":2,"title":"Related information","slug":"related-information","at":2425,"chars":132}],"text":"# Page.RunModal(Integer [, Record] [, Any]) Method\n> Version: _Available or changed with runtime version 1.0._\nCreates, opens, and closes a page that you specify. When a page is run modally, no input, such as a keyboard or mouse click, can occur except for objects on the modal page.\n## Syntax\n```al\n[Action := ]  Page.RunModal(Number: Integer [, Record: Record] [, Field: Any])\n```\n## Parameters\nNumber\nType: ../integer/integer-data-type\nThe number of the page that you want to run.\n*[Optional] Record*\nType: ../record/record-data-type\nBy default, this method shows the record that was last displayed on the page. For each object, information is stored about the most recently shown record and the attached key and filters. Use this optional parameter to select a specific record to display on the page. The record must be of the same type as the table that is attached to the page. When the record is displayed, the key and filters that are attached to the record are used.\n*[Optional] Field*\nType: ../any/any-data-type\nUse this optional parameter to select a specific field which will be in focus.\n## Return Value\n*[Optional] Action*\nType: ../action/action-option\nSpecifies what action the user took on the page.\n## Remarks\nThe parameter Number is an integer and represents the number of the page that you want to run. If you enter zero (0), the system displays the default lookup window for the current page. If the page you specify doesn't exist, a runtime error occurs.\nThe following code lines from the base application illustrate how to specify parameters for the Page.RunModal method with the Number parameter set to zero (0) and thereby display the default lookup window defined for the table.\n```al\ntable 180 \"G/L Account Where-Used\"\n{\n    Caption = 'G/L Account Where-Used';\n    LookupPageID = \"G/L Account Where-Used List\"; // The lookup page for the G/L Account Where-Used table\n    DataClassification = CustomerContent;\n    ...\n}\n```\n```al\ncodeunit 100 \"Calc. G/L Acc. Where-Used\"\n{\n    ...\n    var\n        TempGLAccWhereUsed: Record \"G/L Account Where-Used\" temporary;\n        ...\n\n    ...\n\n    local procedure ShowGLAccWhereUsed()\n    begin\n        OnBeforeShowGLAccWhereUsed(TempGLAccWhereUsed);\n        TempGLAccWhereUsed.SetCurrentKey(\"Table Name\");\n        Page.RunModal(0, TempGLAccWhereUsed); // Page number is zero, show the default lookup window defined for TempGLAccWhereUsed\n    end;\n    ...\n}\n```\n## Related information\npage-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}