Clarify TrySendToEMail comment in print/email good sample

Make explicit that TrySendToEMail is also correct *because* it never
reads the customer's assigned profile (local record, E-Mail option set
by the helper itself), and name Get/GetDefaultForCustomer + Send as the
anti-pattern. Matches the article's Best Practice and BaseApp's own
Sales Invoice Header.EmailRecords.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Michael Dieringer 2026-09-29 17:53:13 +02:00
parent b6a59be325
commit 833a002095

View file

@ -25,8 +25,12 @@ page 50101 "Sample Posted Invoice Card"
// depends only on this customer's registered report/layout, // depends only on this customer's registered report/layout,
// not on any Document Sending Profile setting. Calling // not on any Document Sending Profile setting. Calling
// DocumentSendingProfile.TrySendToEMail(...) instead would // DocumentSendingProfile.TrySendToEMail(...) instead would
// be equally correct: it never Get's the customer's // also be correct, because it never reads the customer's
// actually assigned profile, only a local, hardcoded one. // assigned profile: it only uses a local record that it
// never retrieves with Get, and sets its "E-Mail" option
// itself. The
// anti-pattern is Get/GetDefaultForCustomer followed by
// Send, which makes the outcome depend on that profile.
// "S.Invoice" resolves to a report on "Sales Invoice // "S.Invoice" resolves to a report on "Sales Invoice
// Header", which is the record passed here. // Header", which is the record passed here.
SalesInvoiceHeader := Rec; SalesInvoiceHeader := Rec;