Summary
You designed a Business Central processing service whose codeunits separate required logic, optional reactions, selected strategies, lifecycle work, and unattended execution. These boundaries make transaction and failure behavior explicit while keeping extension-owned data observable.
The resulting design uses direct procedure calls for required work, events for independent subscribers, and an interface for one selected strategy. Install and upgrade codeunits prepare data in their own lifecycle contexts, while a scheduled task runs the same service in a background session and records its outcome through committed extension-owned data.
What you learned
- Define cohesive codeunits, control procedure visibility, and choose between direct calls and conditional
Codeunit.Run. - Use events for independent reactions without relying on subscriber order or overlooking transaction effects.
- Use an interface-backed enum to select one implementation and handle default or unknown values deliberately.
- Separate repeatable installation and upgrade operations by scope, trigger phase, data version, and upgrade tag.
- Schedule a record-backed task, account for background-session constraints, and diagnose success, delay, retry, or failure.
Together, these practices help you decide where state belongs, which component owns a transaction, and how another extension interacts with the service. They also give operators a durable result to inspect when unattended processing doesn't complete as expected.
Learn more
Clean up resources
Unpublish the exercise extension from the sandbox if you no longer need it. Remove any scheduled tasks created by the exercise before you delete its extension-owned processing entries.