Page record methods require a SourceTable
Properties
PC0018
Error
Design
Code Fix
Ignore Obsolete
When a developer calls SetRecord on a page variable to pre-fill it with a specific record, the runtime binds that record to the page’s SourceTable. If the target page has no SourceTable defined, the page has no record buffer — the passed record is never applied, and the page opens without the expected data. The same applies to GetRecord, SetTableView, and SetSelectionFilter.
Define a SourceTable on the target page so the runtime has a record buffer to operate on.
Example
page 50100 "My Dialog"
{
PageType = Card;
}
codeunit 50101 MyCodeunit
{
procedure ShowDialog()
var
Customer: Record Customer;
MyDialog: Page "My Dialog";
begin
MyDialog.SetRecord(Customer); // Page record methods require a SourceTable [PC0018]
MyDialog.Run();
end;
}Add the SourceTable property to the page definition.
page 50100 "My Dialog"
{
PageType = Card;
SourceTable = Customer;
}
codeunit 50101 MyCodeunit
{
procedure ShowDialog()
var
Customer: Record Customer;
MyDialog: Page "My Dialog";
begin
MyDialog.SetRecord(Customer);
MyDialog.Run();
end;
}When the diagnostic is reported
The diagnostic is raised when any of the following methods is called on a page variable whose page definition has no SourceTable property:
SetRecordGetRecordSetTableViewSetSelectionFilter
See also
- SourceTable Property on Microsoft Learn
- Page.SetRecord(var Record) Method on Microsoft Learn
- Page Data Type on Microsoft Learn