# Page.SetRecord(var Record) Method
> Version: _Available or changed with runtime version 1.0._
Sets the current record for the page.
## Syntax
```al
 Page.SetRecord(var Record: Record)
```
## Parameters
Page
Type: page-data-type
An instance of the page-data-type data type.
Record
Type: ../record/record-data-type
The record to set as the current record. You cannot use a temporary record for the Record parameter.
## Remarks
You can use this method to set the record to display when the user opens the page.
## Example
The following example retrieves the record that has a primary key value of '30000' from the Customer table. If the record is found, it is stored in the MyRecord variable. The SetRecord method uses the retrieved record as the current record and sets record for MyPage, which is a Customer Card page. When the codeunit is run, the record is displayed on the MyPage page. If the record is not found, a message box displays a message that indicates that the record was not found.
```al
 var
    MyPage: Page "Customer Card";
    MyRecord: Record Customer;
    Text000: Label 'The record was not found';
begin
    if MyRecord.Get('30000') then begin
      MyPage.SetRecord(MyRecord);
      MyPage.Run;
    end else begin
      Message(Text000);
    end;
end;
```
## Related information
page-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/page/page-setrecord-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/page/page-setrecord-method/
