Register Yourself
Your document export engine ships in a core app, and the formats it can export ship in add-on apps — apps your core has never been compiled against and must never reference. This is the Discovery Event pattern from the BC design catalog: instead of the core keeping a list of providers, it asks "who is out there?" by publishing an event, and every provider that is listening writes itself into the answer. Your job is to build the core engine, the registration buffer it hands around, and one sample provider that plugs in from the outside.
Requirements
1. The registration buffer
Create a table named "Export Format Registration" with TableType = Temporary — registrations are collected in memory per discovery run and must never leave a row in the database.
- Field
Code, typeCode[20], and fieldDescription, typeText[100]. Discovery results iterate sorted ascending byCode, regardless of the order providers registered in. - A table procedure providers call to add themselves:
procedure RegisterFormat(FormatCode: Code[20]; FormatDescription: Text[100]). - Duplicate-code rejection: if the code is already registered, the call does nothing — the first registration wins, and a duplicate must never raise an error (one clumsy provider must not be able to kill everyone's discovery run).
2. The core engine
Complete the codeunit named "Export Format Engine". The starter already declares the two integration events it publishes — the grading tests subscribe to them, so keep their names, parameter names, types, order and var-ness exactly as declared; nothing raises them yet, and raising each one at the right moment is your job:
OnDiscoverFormats(var ExportFormatRegistration: Record "Export Format Registration")
OnExport(FormatCode: Code[20]; Payload: Text; var Output: Text)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