Question 60
An AL extension team encounters the following situation: A project wants to invoke a codeunit by reference but its external consumers cannot access private members. Which technical principle best explains the relevant risk or failure?
Explanation
Correct Answer
Access modifiers and codeunit API surfaces determine what another app can call. The corresponding corrective design is to expose only the necessary documented public procedures and explicit parameter contracts. A passing check is: The dependent extension builds using supported exposed procedures without reflection or internal access.
Incorrect Answers
The related but distinct situation is “A partner's event subscriber updates the same record and recursively triggers the event again”. The underlying mechanism is that event handlers can create loops if side effects retrigger the same notification. For the stated problem, “Access modifiers and codeunit API surfaces determine what another app can call” addresses the central condition.
This option serves the scenario “A company upgrades an app and must transform old shipment flags into a new status enum while preserving records”. App version upgrades may need explicit conversion of persisted data. The present scenario is distinguished by “Access modifiers and codeunit API surfaces determine what another app can call”.
This alternative addresses the separate case “A posting extension needs reusable logic that can be invoked from a page action and an event subscriber”. Codeunits encapsulate reusable AL processing separate from presentation controls. The deciding requirement here is “Access modifiers and codeunit API surfaces determine what another app can call”.