5010

A Session-Scoped Bulk Import Switch

singleinstance
session-state
clearall

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
  1. The mode is one shared state for the whole session: after any code calls Activate(), IsActive() returns true from every variable of "Bulk Import Mode" — including variables declared in other objects — until someone calls Deactivate().
  2. Deactivate() is the only off switch: after it, IsActive() returns false everywhere in the session.
The rest of the statement and 3 hints Unlock with Pro
ALBusiness Central 28.5
Pro
Pro problem

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.

$10 / month
or $100 / year
Upgrade
This problem is part of Pro
Pro unlocks the full statement, tests, hints and solution. The code editor works on a computer.
Upgrade