bcquality/microsoft/knowledge/data-modeling/document-print-and-email-actions-call-report-selections-directly.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

45 lines
1.4 KiB
AL

page 50101 "Sample Settlement Document Card"
{
PageType = Card;
SourceTable = Customer;
ApplicationArea = All;
actions
{
area(Processing)
{
action(EmailDocument)
{
ApplicationArea = All;
Caption = 'Email';
Image = Email;
trigger OnAction()
var
ReportSelections: Record "Report Selections";
begin
// Calls Report Selections directly - the button's outcome
// depends only on this customer's registered report/layout,
// not on any Document Sending Profile setting.
ReportSelections.SendEmailToCust(
"Report Selection Usage"::"S.Invoice".AsInteger(), Rec, Rec."No.",
Rec.Name, true, Rec."No.");
end;
}
action(PrintDocument)
{
ApplicationArea = All;
Caption = 'Print';
Image = Print;
trigger OnAction()
var
ReportSelections: Record "Report Selections";
begin
ReportSelections.PrintWithDialogForCust(
"Report Selection Usage"::"S.Invoice", Rec, true, Rec.FieldNo("No."));
end;
}
}
}
}