Question 80
At fictional Trinity Trading, the Business Central development team is supporting cross-border purchasing and reviewing object model and application extensibility during a troubleshooting exercise (MB820-3.4-097). The observed development issue is that a developer uses an OnValidate trigger to set a field but also assumes direct database updates always invoke field validation. Which AL development or design response most directly addresses this issue?
Explanation
Correct Answer
The most direct corrective response is to call the appropriate validation mechanism when business rules must run during programmatic updates. This addresses the specific failure where a developer uses an OnValidate trigger to set a field but also assumes direct database updates always invoke field validation. Acceptance evidence is that data updates via the intended code path apply field validation consistently.
Incorrect Answers
“Subscribe to an appropriate published business event or design a reusable codeunit validation at the relevant process boundary” concerns the alternative task “subscribe to an appropriate published business event or design a reusable codeunit validation at the relevant process boundary”, but the stated failure is that a developer uses an OnValidate trigger to set a field but also assumes direct database updates always invoke field validation. The required measure is to call the appropriate validation mechanism when business rules must run during programmatic updates.
“Use available integration events and a subscriber or suitable extension point” supports the separate task “use available integration events and a subscriber or suitable extension point”, not the reported problem: a developer uses an OnValidate trigger to set a field but also assumes direct database updates always invoke field validation. This case instead calls for “call the appropriate validation mechanism when business rules must run during programmatic updates”.
“Inspect the event signature and handle missing or incomplete values according to contract” concerns the separate step “inspect the event signature and handle missing or incomplete values according to contract”. The reported issue is that a developer uses an OnValidate trigger to set a field but also assumes direct database updates always invoke field validation, so the direct response is to call the appropriate validation mechanism when business rules must run during programmatic updates.