FORM.RUNMODAL Function (Form)

Microsoft Dynamics Nav 2009

Creates, runs, and closes a form object that you specify. The form is run modally. When a form is run modally, no input (keyboard or mouse click) can occur except to objects on the modal form. If, at design time, you do not know the specific form that you want to run, use this function or the FORM.RUN Function (Form). If you do know the specific form that you want to run, you can use the RUN Function (Form) or RUNMODAL Function (Form) to specify a variable.

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



Type: Integer

A number that identifies a form object. If you enter zero (0), the default lookup window for the current form is displayed. You can use the Symbols option on the View menu to choose from a list.

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


Type: Record

This function shows, by default, the record last displayed on the form. For each object, information about the most recently shown record and the attached key and filters is stored.

Use this optional parameter to select a specific record to display on the form. The record must be of the same type as the table attached to the form. 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

If you have code that calls the FORM.RUNMODAL function and you run this code on the NAV Server, then the code is translated to call the PAGE.RUNMODAL Function instead.

This example shows how to use the FORM.RUNMODAL function to run form 4711.

IF FORM.RUNMODAL(4711, SomeRecord, ...) = Action::LookupOK THEN... 

Community Additions