A Session-Scoped Bulk Import Switch
Every night your app imports thousands of legacy orders, and every single line pays for an expensive amount validation that only matters for hand-typed entries. The import routine wants to switch that validation off for the duration of the run — but the switch and the validator live in different objects, the import reaches them through different code paths, and somewhere in between a cleanup routine calls ClearAll. You need one flag the whole session agrees on: flipped anywhere, seen everywhere, and immune to ClearAll.
Requirements
Create a codeunit named "Bulk Import Mode" with three public procedures:
procedure Activate()
procedure Deactivate()
procedure IsActive(): Boolean- The mode is one shared state for the whole session: after any code calls
Activate(),IsActive()returnstruefrom every variable of"Bulk Import Mode"— including variables declared in other objects — until someone callsDeactivate(). Deactivate()is the only off switch: after it,IsActive()returnsfalseeverywhere in the session.
Solve it with Pro
You’re reading the opening of the statement. Pro unlocks the whole problem:
- The full statement
- Starter code in the browser editor
- 10 grading tests, run on Business Central 28.5
- 3 hints
- The reference solution
Pro also opens all 92 Pro problems and lifts the daily limits on compile checks and submissions.
Already on Pro? Sign in