5043

Restricted Accounts, Stamped Documents

event-subscriber
gen-journal
posting-checks
validation
table-extension

Restricted Accounts, Stamped Documents

The auditors flagged a handful of G/L accounts — legal settlements, restructuring reserves — as restricted: nothing may reach them without a controlled document number issued by the audit desk, and those numbers always start with CTRL-. Journal lines are keyed in by many people and posted by more than one routine, so the rule cannot live in a page or in one posting report — it has to sit where every general journal line is checked on its way to the ledger. That check is base application code you cannot modify; extend it from the outside.

Requirements

  1. Create a table extension for the G/L Account table with a field named Restricted of type Boolean. Grading reads and writes it in code — no page work is needed.
  2. Put your rule in a new codeunit — its name is up to you (not graded); the starter calls it "Journal Check Rule".
  3. The rule guards both sides of a general journal line: when "Account Type" is G/L Account and "Account No." names a restricted account, or "Bal. Account Type" is G/L Account and "Bal. Account No." does, the line may only post if its "Document No." starts with CTRL- — the first five characters, so a CTRL- buried in the middle does not count.
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
  • 9 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