Send It, Prove It
Your customer wants order confirmations mailed out the moment an order is confirmed: a friendly HTML note to the buyer, the purchasing team on CC, and the confirmation PDF attached. Operations has one extra demand — proof. A dispatched confirmation must show up where every Business Central user looks for it, the Sent Emails list, and a failed one must not vanish: it has to sit in the Email Outbox, marked failed, with the reason attached. That rules out hand-rolled transport — you are wiring this into the email subsystem Business Central itself sends documents through.
Requirements
Create a codeunit named "Order Confirmation Mailer" with exactly this public procedure:
procedure SendConfirmation(AccountId: Guid; Connector: Enum "Email Connector"; ToRecipients: List of [Text]; CcRecipients: List of [Text]; OrderNo: Code[20]; CustomerName: Text; Document: InStream): BooleanComposing the message
Each call composes exactly one email message:
- The To recipients are exactly
ToRecipientsand the CC recipients are exactlyCcRecipients, each list on its own address line — CC addresses must not leak into To or vice versa. The order in which the subsystem stores the addresses of a line is its own business and not graded.CcRecipientsmay be empty. - The subject is exactly
Order <OrderNo> confirmed— for orderSO-1042that isOrder SO-1042 confirmed.
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
- 10 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