Using OdataKeyFields for fetching records in Business Central Web Services


Business Central provides us with Web Services which we can use for CRUD operations on specific tables. However it also provides us with different methods of accessing specific records for CRUD operations.


Business Central On-Premise or OnCloud.



In Business Central, if we do not specify the ODataKeyFields as a property on the Page that we’ll be using as Web Service, then by default we have to use the Primary Key.

However if we specify the “ODataKeyFields” in the page, we can use the field we have specified as the key for pulling the record in Web Services.

While there are no limitations on which field can be used as key field, keep in mind that Business Central fetches the first record matching that field.

For instance if you use the “Buy-from Vendor No.” as the ODataKeyField, then the Web Service will fetch the first matching record sorted by the Primary Key.

Standard Business Central APIs use the “SystemId” field as the ODataKey field.

You can also use multiple Keys in ODataKeyFields and use them for fetching records.


Thus, we saw how we can use ODataKeyFields property for fetching records and performing CRUD operations. As a side note, you can also use multiple keys in ODataKeyFields.

Share Story :