Skip to content

5 AL/BC patterns: document distribution (Report Selections, Document Sending Profile, Find Entries, TransferFields) - #175

Open
Michael Dieringer (MichaelDieringer) wants to merge 1 commit into
microsoft:mainfrom
Curabis:community-contribution/document-distribution-batch
Open

Michael Dieringer (MichaelDieringer) wants to merge 1 commit into
microsoft:mainfrom
Curabis:community-contribution/document-distribution-batch

Conversation

@MichaelDieringer

Copy link
Copy Markdown

Summary

Five rules about Business Central's document distribution architecture, verified against BCApps source and Microsoft Learn:

  • custom-document-dispatch-must-not-bypass-report-selections — a codeunit that hardcodes a report ID and builds its own email instead of registering through Report Selections loses per-account layout overrides and "Document Layouts" discoverability.
  • document-print-and-email-actions-call-report-selections-directly — a document's own Print/Email actions call Report Selections directly; Document Sending Profile is scoped specifically to the combined Post-and-Send action, not general print/email.
  • extend-find-entries-navigate-for-new-document-types — registering a custom table with Find Entries (page 344 Navigate) requires both OnAfterFindRecords and OnBeforeShowRecords; either alone leaves a result row with nothing to open it.
  • extend-report-selection-usage-for-new-document-types — a new Report Selection Usage value needs both ReportSelections.InsertRecord and a subscriber to the Customer/Vendor "Document Layouts" filter events, or the per-account override UI never lists the new document type.
  • transferfields-mirrored-fields-must-match-type-and-length — a field mirrored across a TransferFields posting cascade (e.g. Sales HeaderSales Invoice Header) must match type and length exactly; a length-only mismatch compiles and posts cleanly until a value finally exceeds the shorter definition.

Each article cites specific BCApps source (file, procedure, and in most cases line number) and, where applicable, Microsoft Learn. Wired into al-data-modeling-review.md's worklist cues so all five are reachable in review. Added a disambiguation note on the TransferFields article distinguishing it from the existing transferfields-skip-type-mismatch-can-drop-data.md — that article covers SkipFieldsNotMatchingType masking a type mismatch; this one covers the length dimension, which that parameter does not affect at all.

Test plan

  • CI frontmatter/format validation passes
  • Domain-owning reviewers confirm placement and accuracy per file

🤖 Generated with Claude Code

…ent 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>
@MichaelDieringer

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="CURABIS ApS"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes on 83f041b6624b965c061e05bc36cbdc1926399be2.

The exact-tree validators pass (frontmatter; deterministic 305-article index; 34 fixtures/17 leaves), but these are necessary before the rules are safe to execute:

  1. Owning-skill reachability is contradictory. al-data-modeling-review still scopes relevance/not-applicable/outcome to setup/master/key/numbering/block/audit surfaces, and its initial tokens omit all five new signal families. The appended worklist cues therefore do not make document actions, Navigate subscribers, report-selection registration, or posting-cascade extensions deterministically reachable. Extend the entry gate/scope and prove each route.
  2. The Document Sending Profile rule and bad fixture do not match current BCApps semantics. Ordinary Sales Invoice Header.PrintRecords/EmailRecords use stateless DocumentSendingProfile.TrySendToPrinter/TrySendToEMail, not direct Report Selections; the article names only Purchase Header as an exception. Conversely, the bad sample calls Send on a blank record. Send does not load the customer's assigned profile, so this sample does not make the outcome depend on that profile—it simply has all sending options at their default No. Permit the stateless helpers and load a configured/default customer profile in the actual anti-pattern.
  3. The Report Selection Usage rule is overbroad and incomplete. Requiring both customer and vendor filter subscribers even for a one-sided document is contradicted by current ReportSelectionHandlerCZZ, which partitions sales usages to the customer page and purchase usages to the vendor page. Also, filter subscribers alone only affect Copy from Report Selection; full Document Layouts display/edit support requires extending the page-facing usage enum and handling its map/validate events, as the cited CZC implementation itself does. Scope to the applicable counterparty and either include those pieces or narrow every claim to the copy action.
  4. Evaluation does not exercise any new rule. The generated data-modeling control still selects check-blocked-in-referencing-code-not-in-master; all five new good/bad pairs are only existence/ranking inputs. Add deterministic positive/clean coverage that demonstrates the corrected owning-skill routes and semantics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants