Export (0) Print
Expand All


Microsoft Dynamics Nav 2009

Creates, runs, and closes a specified page object. When a page is run modally, no input (keyboard or mouse click) can occur except to objects on the modal page.

[Action :=] Page.RUNMODAL(Number[, Record][, Field])



Type: Integer

The number of the page that you want to run. If you enter zero (0), the default lookup window for the current page is displayed. Click View and then click C/AL Symbols Menu to select the page from a list.

If the page you specify does not exist, a run-time error occurs.


Type: Record

This function shows, by default, the record last displayed on the page. For each object, the system stores information 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 attached to the page. When the record is displayed, the key and filters attached to the record are used.


Type: Field

Use this optional parameter to select a specific field on which focus will be placed.

Type: Code

Specifies what action the user took. The following table shows the possible return values.

Return value Description


The user selected OK to exit the window


The user selected Cancel to exit the window


The user selected OK on a lookup window


The user selected Cancel on a lookup window


The user selected Yes


The user selected No


The user selected Close, ESC, or closed the window using the title bar


The user selected Help


The user selected an option that ran another object


The user selected an option that ran an external program

The page is run modally. If, at design time, you do not know the specific page you want to run, then use this function or the PAGE.RUN Function.

If you do know the specific page you want to run, then you can use the RUN Function (Page) or RUNMODAL Function (Page) to specify a variable.

When you want to close the page, use CurrPage.CLOSE. CurrPage is a predefined system variable.

It is important to remember that pages that have been created by transforming existing forms still use the same code as the original forms. Furthermore, when you compile your code to C#, forms and pages are both treated as forms.

If, from a page, you call another form that does not have a corresponding page, you will receive an error message.

If you run this page function on a Classic client, you receive an error because the Classic client does not support pages.

This example shows how to call page 4711.

IF IsServiceTier THEN
  Page.RUNMODAL(4711, MyRecord, ...);
  IF Form.RUNMODAL(4711, MyRecord, ...) = Action::LookupOK THEN...;

Community Additions

© 2014 Microsoft