5011

Run the Data Fix Exactly Once

upgrade-tags
data-upgrade
idempotency
event-subscriber
system-application

Run the Data Fix Exactly Once

Version 1 of your loyalty extension had a bug: it never granted the one-time 100-point signup bonus, so every member recruited under v1 is 100 points short. Version 2 ships a data-fix routine that grants those points retroactively — and a routine like that is dangerous: run it twice and every member is overpaid, run it in a brand-new company and it "fixes" data that was never broken. Business Central's answer is the upgrade-tag pattern from the System Application: the fix marks the company once it has run, checks the mark before running, and fresh companies are born with the mark already set.

One platform note: grading cannot trigger a real extension upgrade, so you write the fix as a plain public procedure that the tests call directly — in production the same body would sit behind an upgrade codeunit's OnUpgradePerCompany trigger.

Requirements

The starter ships the "Loyalty Member" table ("No.", Name, Points) — do not change it; the tests rely on it exactly as given. Your work is the codeunit named "Loyalty Data Fix" with these two public procedures:

procedure GrantMissingSignupBonus()
procedure GetSignupBonusUpgradeTag(): Code[250]
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
  • 6 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