ODataKeyFields should use SystemId
When building an API page, developers sometimes set ODataKeyFields to a business key like "No." — the field that identifies the record in the UI. OData consumers use this key to construct stable URLs for individual records (e.g., .../customers(KEY)), so changing a key value invalidates every external reference built on it.
If the key field value changes — a customer number is renumbered, a code is corrected — Power Automate flows and Power Apps connections that cached the old key silently stop resolving the record.
We recommend you always specify a single field of type GUID in the
ODataKeyFieldsproperty. Otherwise, some external integrations such as Power Automate and Power Apps do not work with your new API.
— Developing a custom API on Microsoft Learn
Set ODataKeyFields to SystemId
instead. SystemId is a GUID assigned at record creation that never changes.
Example
page 50100 "Customer Entity"
{
PageType = API;
ODataKeyFields = "No."; // ODataKeyFields should use SystemId [PC0025]
SourceTable = Customer;
}Set the ODataKeyFields property to SystemId and expose it as a field in the page layout:
page 50100 "Customer Entity"
{
PageType = API;
ODataKeyFields = SystemId;
SourceTable = Customer;
layout
{
area(Content)
{
repeater(Group)
{
field(id; Rec.SystemId)
{
Editable = false;
}
}
}
}
}Exception
The rule does not trigger on API pages where SourceTableTemporary = true, since temporary records are not exposed via OData.
See also
- API Page / Query on alguidelines.dev