SetRecord() does not support temporary records

Properties
PC0036 Warning Usage Code Fix Ignore Obsolete

Page.SetRecord binds a page to a specific database record so the page opens at that position. The method does not accept temporary records:

You cannot use a temporary record for the Record parameter.

Page.SetRecord(var Record) Method on Microsoft Learn

Passing a temporary record variable to SetRecord causes a runtime error. Use a non-temporary record variable instead.

Example

procedure ShowCustomer()
var
    TempCustomer: Record Customer temporary;
    CustomerPage: Page "Customer Card";
begin
    TempCustomer.Init();
    TempCustomer."No." := 'TEMP001';
    TempCustomer.Insert(false);
    CustomerPage.SetRecord(TempCustomer); // SetRecord() does not support temporary records [PC0036]
    CustomerPage.Run();
end;

Use a non-temporary record variable that references an existing database record:

procedure ShowCustomer(CustomerNo: Code[20])
var
    Customer: Record Customer;
    CustomerPage: Page "Customer Card";
begin
    Customer.Get(CustomerNo);
    CustomerPage.SetRecord(Customer);
    CustomerPage.Run();
end;

See also