Delete the Header, Leave No Orphans
Header–lines pairs are everywhere in Business Central — Sales Header and Sales Line being the classic. Two rules keep such a pair healthy: deleting the header must take its lines with it, and a posted document must never be deletable. Both rules belong in the header table's OnDelete trigger — and both silently vanish whenever code deletes with triggers switched off. This task makes you feel exactly where that line runs.
What you are given
The starter contains two tables. "Work Order Line" is finished — submit it unchanged. "Work Order" compiles but its OnDelete trigger is empty, so today it deletes cleanly and leaves every line orphaned.
- Table
"Work Order": field"No."(Code[20], PK),Description(Text[100]),Posted(Boolean). - Table
"Work Order Line": keyed"Work Order No."+"Line No.", with aQuantity(Decimal).
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
- 7 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