Use AddLoadFields on OnOpenPage and OnPreDataItemTrigger #1167
lv-janpieter
started this conversation in
New Rule
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Just dropping a thought, and i'm curious what the community thinks of this.
In API pages and reports utilize partial record loading to optimize performance by loading only specified fields. Microsoft recommends using the AddLoadFields method in the OnOpenPage trigger for pages and the OnPreDataItem trigger for reports to explicitly load additional fields referenced in AL code but not included in the page or report dataset. This rule proposes a code analyzer check to identify fields used in AL code (e.g., in triggers, functions, or calculations) that are not explicitly loaded via AddLoadFields. If such a field is detected, the analyzer will issue a warning to alert developers of potential runtime errors or performance issues due to missing field data. The rule will apply to API pages, reports (and maybe other objects in the future).
https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-partial-records
Benefits:
Implementation:
Considerations:
Beta Was this translation helpful? Give feedback.
All reactions