bcquality/microsoft/knowledge/data-modeling/custom-document-dispatch-must-not-bypass-report-selections.good.al
Michael Dieringer 83f041b662 Add 5 AL/BC patterns: document distribution (Report Selections, Document Sending Profile, Find Entries, TransferFields)
Five rules about Business Central's document distribution architecture,
verified against BCApps source and Microsoft Learn.

- custom-document-dispatch-must-not-bypass-report-selections
- document-print-and-email-actions-call-report-selections-directly
- extend-find-entries-navigate-for-new-document-types
- extend-report-selection-usage-for-new-document-types
- transferfields-mirrored-fields-must-match-type-and-length

Wired into al-data-modeling-review.md's worklist cues. Added a
disambiguation note on the TransferFields article distinguishing it from
the existing transferfields-skip-type-mismatch-can-drop-data.md
(type-mismatch skipping vs. length mismatch, which SkipFieldsNotMatchingType
does not affect).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-10 07:44:17 +02:00

22 lines
824 B
AL

codeunit 50102 "Sample Settlement Document Send"
{
procedure SendSettlementDocument(var Customer: Record Customer)
var
ReportSelections: Record "Report Selections";
begin
// Custom validation specific to this document stays here...
CheckReadyToSend(Customer);
// ...but dispatch goes through the registered usage, so per-account
// report/layout overrides and email attachment/body configuration
// on Report Selections all apply automatically.
ReportSelections.SendEmailToCust(
"Report Selection Usage"::"S.Invoice".AsInteger(), Customer, Customer."No.",
Customer.Name, true, Customer."No.");
end;
local procedure CheckReadyToSend(var Customer: Record Customer)
begin
Customer.TestField("E-Mail");
end;
}