ODataKeyFields should use SystemId (PC0025)
API pages should use SystemId as the ODataKeyFields for consistent and reliable record identification. Using custom fields as keys can lead to issues when records are modified or when the key values contain special characters.
Example
The following API page uses a custom key:
page 50100 "My API Page"
{
PageType = API;
ODataKeyFields = "No."; // ODataKeyFields should use SystemId [PC0025]
SourceTable = Customer;
}
To fix this, use SystemId:
page 50100 "My API Page"
{
PageType = API;
ODataKeyFields = SystemId;
SourceTable = Customer;
layout
{
area(Content)
{
field(systemId; Rec.SystemId)
{
}
}
}
}