Preview Without a Trace
Every accountant's favorite button is Preview Posting: show me exactly the ledger entries this journal would create — without creating them. The naive implementation posts for real and cleans up after itself, and it always leaves fingerprints: a burned entry number, a fresh SystemId, a commit that quietly made something permanent. The pattern behind Business Central's own posting preview rehearses the real posting and then makes the whole rehearsal vanish. You build that pattern on a custom ledger.
The starter ships four finished data objects. Do not rename them or their fields — the grading tests bind to every name below character for character.
The objects you get
- Table
"Reward Journal Line"— primary key"Line No."(Integer); fields"Customer No."(Code[20]),Points(Integer),Description(Text[50]). - Table
"Reward Ledger Entry"— primary key"Entry No."(Integer); fields"Customer No."(Code[20]),Points(Integer),Description(Text[50]),"Register No."(Integer). - Table
"Reward Register"— primary key"No."(Integer); fields"From Entry No."(Integer),"To Entry No."(Integer). - Table
"Reward Setup"— primary key"Primary Key"(Code[10]); fields"Last Entry No."(Integer),"Last Register No."(Integer). The single row with a blank"Primary Key"always exists when your code is called — the tests seed it.
Requirements
Implement both procedures in the codeunit "Reward Posting":
procedure Post()
procedure Preview(var TempRewardLedgerEntry: Record "Reward Ledger Entry" temporary; var TempRewardRegister: Record "Reward Register" temporary)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
- 14 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