BC Friday Tips #10 Use SetLoadFields to partially load data from a table

SetLoadFields

Happy Friday! Time for our weekly BCFridayTips for the msdyn365bc developers!

Use SetLoadFields to partially load data from a table.

Why?

✅ Improve Performance. Fetching only the necessary fields can significantly improve performance, particularly when dealing with table extensions.

However, remember that using it for write transactions could be counter-productive because logic on triggers and event subscribers can cause the record to be fully loaded.

It’s also recommended not to use it when executing multiple queries on the same table with varying field sets, like Setup Tables. In such cases, loading all fields and utilising cached data for subsequent queries is more efficient.

thatnavguy

Experienced NZ-based NAV Developer and Consultant with 15+ years of experience leading multiple IT projects, performing business analyst, developing, implementing, and upgrading Dynamics NAV and Business Central. Passionate to deliver solution that focuses on user-friendly interface while keeping high standard of compliance with the needs.

You may also like...

2 Responses

  1. “However, remember that its usage should be limited to read transactions. Using it for write transactions would be counter-productive because the write transaction requires the record to be fully loaded.”

    That’s not (always) correct, see https://x.com/PhDuck2/status/1530892365891833857 and https://x.com/PhDuck2/status/1530893275577581569.

Leave a Reply

Your email address will not be published. Required fields are marked *