Page record argument mismatch (PC0017)

When calling Page.Run or Page.RunModal with a record variable, the record type must match the page’s SourceTable. Passing a record of a different type will result in a runtime error.

Example

The following code passes a mismatched record type:

codeunit 50100 MyCodeunit
{
    procedure ShowVendor()
    var
        Customer: Record Customer;
    begin
        Page.Run(Page::"Vendor Card", Customer); // Page record argument mismatch [PC0017]
    end;
}

To fix this, use the correct record type:

codeunit 50100 MyCodeunit
{
    procedure ShowVendor()
    var
        Vendor: Record Vendor;
    begin
        Page.Run(Page::"Vendor Card", Vendor);
    end;
}