Question 20
At fictional Orchard Agriculture, the Business Central development team is supporting farm supplier procurement and reviewing AL business logic and user experience during a code quality review (MB820-4.3-147). The observed development issue is that an extension assumes FindFirst will always find a matching ledger row and crashes when the set is empty. Which observed result would most clearly show the intended correction works?
Explanation
Correct Answer
This is the outcome that directly verifies the intended correction: a missing record yields a defined outcome instead of an unexpected runtime error. The related solution is to check the Boolean result of the record lookup and handle not-found cases deliberately; it is based on the principle that record API success conditions must be handled explicitly.
Incorrect Answers
“Only records matching the verified customer criteria are processed” concerns the alternative task “apply the intended record filter and validate current filter groups when composing queries”, but the stated failure is that an extension assumes FindFirst will always find a matching ledger row and crashes when the set is empty. The required measure is to a missing record yields a defined outcome instead of an unexpected runtime error.
The proposed “Totals remain mathematically correct across decimal precision and locale settings” tests a different control: use a suitable Decimal variable and numeric expressions, formatting only at display boundaries. The reported condition is that an extension assumes FindFirst will always find a matching ledger row and crashes when the set is empty; the more direct action is to a missing record yields a defined outcome instead of an unexpected runtime error.
“Invalid values are rejected before record mutation and valid values are stored consistently” supports the separate task “use appropriate AL types, validation logic and explicit procedure parameters”, not the reported problem: an extension assumes FindFirst will always find a matching ledger row and crashes when the set is empty. This case instead calls for “A missing record yields a defined outcome instead of an unexpected runtime error”.