Edit

Share via


Page.RunModal(Integer, Record, Integer) Method

Version: Available or changed with runtime version 1.0.

Creates, 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.

Syntax

[Action := ]  Page.RunModal(Number: Integer, Record: Record, FieldNo: Integer)

Parameters

Number
 Type: Integer
The number of the page that you want to run.

Record
 Type: Record
By 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.

FieldNo
 Type: Integer
Use this optional parameter to select a specific field on which focus will be put.

Return Value

[Optional] Action
 Type: Action
Specifies what action the user took on the page.

Remarks

The 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.

The 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.

table 180 "G/L Account Where-Used"
{
    Caption = 'G/L Account Where-Used';
    LookupPageID = "G/L Account Where-Used List"; // The lookup page for the G/L Account Where-Used table
    DataClassification = CustomerContent;
    ...
}
codeunit 100 "Calc. G/L Acc. Where-Used"
{
    ...   
    var
        TempGLAccWhereUsed: Record "G/L Account Where-Used" temporary;
        ...

    ...

    local procedure ShowGLAccWhereUsed()
    begin
        OnBeforeShowGLAccWhereUsed(TempGLAccWhereUsed);
        TempGLAccWhereUsed.SetCurrentKey("Table Name");
        Page.RunModal(0, TempGLAccWhereUsed); // Page number is zero, show the default lookup window defined for TempGLAccWhereUsed
    end;
    ...
}

Page Data Type
Get Started with AL
Developing Extensions