Business Central 2023 wave 2 (BC23): New Record.SetBaseLoadFields() Method

Dynamics 365 Business Central

Hi, Readers.
Dynamics 365 Business Central 2023 wave 2 (BC23) is generally available. More details: General availability: Dynamics 365 Business Central 2023 release wave 2 (BC23)
And all the sessions of Business Central Launch Event (2023 release wave 2) are available now!

I will continue to test and share some new features that I hope will be helpful.

Today I would like to share a new method in Business Central 2023 wave 2 (BC23) – runtime version 12.0, Record.SetBaseLoadFields() Method.

Record.SetBaseLoadFields() Method: Sets that only fields for the base table to be initially loaded when the record is retrieved from its data source. This will overwrite fields previously selected for initial load.

VersionAvailable or changed with runtime version 12.0.

And this is also mentioned in AL Language extension changelog Version 12.0

Add SetBaseLoadFields record API
Adds the ability to select all fields defined on the base table for initial loading on a record, only delay loading fields defined in table extensions.

First, we discussed Dynamics 365 Business Central: Record.SetLoadFields Method (Partial Records) before, a new method from Dynamics 365 Business Central 2020 Wave 2 (BC17).
This method is part of the partial records capability for improving performance, the partial records capability in Business Central allows for loading a subset of normal table fields when accessing a SQL based data source. Using partial records improves performance of objects like reports and OData pages – objects whose source code loops through records. It’s particularly beneficial when table extensions are used in the application.
As you can see in the below sample, you can use SetLoadFields to set which fields you want to retrieve in your operation and the next FindSet() will retrieve only those fields. This will improves performance of Business Central.

Result:

Then, Microsoft brings us new Data model for table extensions in this wave,. More details: Business Central 2023 wave 2 (BC23): New Data model for table extensions (Better performance when working with multiple extensions)

So starting from BC23, there will be at most one base table and one companion table for a standard table.

This new method is used to only read the data of the base table (adds all fields from base table to loaded fields). If you use Record.SetLoadFields method, you need to manually add the fields you need. Maybe it’s true, as Microsoft mentioned, that developers are lazy😑……

It is also very easy to use, here is a simple example:

Great. Give it a try!!!😁

More details about Using partial records -> API Overview:

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL