Features/643211/migrate existing word report layouts to composite document report structure - #10240
Conversation
Work item: AB#640703 Subscribe to the platform GetCompanyMetadata business event in ReportManagement and populate a shared company block (name, formatted address, phone/fax/email/ home page, bank, VAT/registration, giro, logo) from Company Information, so report layouts can bind one shared source instead of hand-coding company fields. - New Company Metadata Builder codeunit: typed setters centralize the wire keys (the subscriber never hand-writes raw key strings), including the address-line repeater and paired field captions. - CompanyDisplayName is sourced from the Company record (CompanyProperty.DisplayName, fallback to CompanyName) to match how the platform builds ReportRequest, not Company Information "Name 2". - Empty-safe: absent Company Information fields emit present-but-empty values. - Add Tests-Report coverage for values, captions, display-name source, empty-safe behavior, and the address repeater.
Add Company Metadata Builder.PopulateFromCompanyInformation to own the Company Information field -> wire-key mapping (name, formatted address, phone/fax/email/home page, VAT/registration, bank, and giro fields with their captions). ReportManagement.GetCompanyMetadata is now orchestration only: fetch the record, set the derived display name and logo, populate the block, and write. The emitted payload is unchanged. Prefix the new ReportManagement self-calls with this. (AA0248). Work item: AB#640703
Codeunit 139596 was already used by the Shopify test app (ShpfyItemAttrAsOptionTest), which caused an object-ID conflict when the test apps are installed together. Move Company Metadata Test to 139593 (unused, next to the sibling Report Layouts Test). Work item: AB#640703
Bring in platform uptake (BCArtifact 29.0.52770.0) so CI can find the platform event this change depends on. See PR #9094.
…ata-subscriber' into features/643211/migrate-existing-word-report-layouts-to-composite-document-report-structure
CP0529-413 5084 Email Merge EMail Merge (Word) CP0529-365 1017 Project Task Quote Project Task Quote (Word) CP0529-364 1016 Project Quote Project Quote (Word) CP0529-402 1309 Return Receipt Standard Sales Return Receipt - themable Word layout CP0529-402 1309 Return Receipt Standard Sales Return Receipt - Blue (Word) CP0529-402 1309 Return Receipt Standard Sales Return Receipt (Word)
CP0529-394 Sales - Credit Memo Standard Sales Credit Memo Email (Word) CP0529-395 1307 Sales - Credit Memo Standard Sales Credit Memo - themable Word layout
…ing-word-report-layouts-to-composite-document-report-structure_AKN Features/643211/migrate existing word report layouts to composite document report structure akn
CP0529-376 1304 Sales - Quote Standard Sales Quote - blue themable Word layout CP0529-375 1304 Sales - Quote Standard Sales Quote - Blue (Word) CP0529-374 1304 Sales - Quote Standard Sales Quote (Word)
CP0529-399 1308 Sales - Shipment Standard Sales Shipment - themable Word layout
CP0529-406 1322 Purchase - Order Standard Purchase Order (Word)
CP0529-368 1303 Draft Invoice Standard Sales Draft Invoice - themable Word layout CP0529-369 1303 Draft Invoice Standard Sales Draft Invoice Email (Word) CP0529-370 1303 Draft Invoice Standard Sales Draft Invoice (Word)
CP0529-388 1306 Sales - Invoice Standard Sales Invoice - Blue (Word) CP0529-389 1306 Sales - Invoice Standard Sales Invoice - themable Word layout CP0529-390 1306 Sales - Invoice Standard Sales Invoice Email (Word) CP0529-391 1306 Sales - Invoice Standard Sales Invoice - VAT Spec (Word)
…e (Word) CP0529-373 reportextension 6298 Sales - Quote Standard ESG Sales Quote - Blue (Word)
…ion for Subscription Billing (Word)
… Sales - Credit Memo - E-Document (Word)
…e - E-Document (Word)
…scription Billing (Word)
…ption Billing (Word)
…voice (Word) CP0529-385 reportextension 6299 Sales - Invoice Standard ESG Sales Invoice - Blue (Word)
| Caption = 'Standard Sales Credit Memo Blue (Word)'; | ||
| Summary = 'The Standard Sales Credit Memo Blue (Word) provides a layout with a blue theme.'; | ||
| } | ||
| layout("StandardSalesCreditMemoNABody.docx") |
There was a problem hiding this comment.
This NA fork adds a new body-only layout (StandardSalesCreditMemoNABody.docx) but leaves the existing legacy Word layouts (e.g. StandardSalesCreditMemo.docx, StandardSalesCreditMemoBlue.docx) active with no ObsoleteState = Pending / ObsoleteReason / ObsoleteTag and no #if not CLEAN32 guard. Because this file is a full NA-specific fork of the W1 report, the base-layer obsoletion changes applied to the corresponding W1 report do not flow here, so this report misses the same Pending-stage retirement given to its sibling layouts across the rest of the PR.
Knowledge:
- microsoft/knowledge/upgrade/obsolete-pending-to-removed-staging.md
- microsoft/knowledge/upgrade/obsoletion-requires-reason-and-tag.md
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4
|
A new composite layout WordLayoutBody is added as the intended replacement, but the existing WordLayout block is left active with no ObsoleteState = Pending, ObsoleteReason, ObsoleteTag, or #if not CLEAN32 guard — unlike ~50 sibling report files in this same PR that mark their legacy Word layout Pending when adding a body-only replacement. Suggested fix (apply manually — could not be anchored as a one-click suggestion): layout(WordLayout)
{
Type = Word;
LayoutFile = './CRM/Reports/ContactCoverSheet.docx';
Summary = 'Report layout made for print. Use a Word editor to modify the layout.';
ObsoleteState = Pending;
ObsoleteReason = 'This Word layout will be replaced by the new Report Layout Experience. Use the corresponding composite (body) layout instead. It will be removed in a future release.';
ObsoleteTag = '32.0';
}Knowledge:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4 |
|
A new WordBody layout is added as the body-only replacement, but the existing Word layout is left active with no ObsoleteState = Pending, ObsoleteReason, ObsoleteTag, or #if not CLEAN32 guard, unlike the ~50 other report files in this PR that stage the corresponding legacy Word layout as Pending when adding its body-only replacement. Suggested fix (apply manually — could not be anchored as a one-click suggestion): layout(Word)
{
Caption = 'Inventory Customer Sales Word';
LayoutFile = '.\Inventory\Reports\InventoryCustomerSales.docx';
Type = Word;
Summary = 'Built in layout for the Inventory Customer Sales Word report.';
ObsoleteState = Pending;
ObsoleteReason = 'This Word layout will be replaced by the new Report Layout Experience. Use the corresponding composite (body) layout instead. It will be removed in a future release.';
ObsoleteTag = '32.0';
}Knowledge:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4 |
Co-authored-by: MSlenejennum <276599928+MSlenejennum@users.noreply.github.com>
…s/features/643211/migrate-existing-word-report-layouts-to-composite-document-report-structure
Predrag Maricic (PredragMaricic)
left a comment
There was a problem hiding this comment.
S1 - Clean builds fail on the obsoleted layouts (High)
Build Apps W1 (Clean) fails with 74 AS0105 errors because report layouts marked with ObsoleteTag = '32.0' are still referenced while AppSourceCop's minimum supported obsolete tag is 99.9. The same pattern explains the clean-build failures across country apps. The obsoletion strategy must be reconciled with clean-mode analyzer rules before merge.
S2 - Preserve the APAC report's RDLC default (High)
In src/Layers/APAC/BaseApp/Sales/Reports/SalespersonSalesStatistics.Report.al, DefaultRenderingLayout still points to RDLCLayout, but this PR changes that layout from RDLC to Excel and introduces the RDLC file under a new RDLC identifier. Tenants using the default therefore receive Excel instead of RDLC, contradicting the stated additive/no-default-change scope. Keep RDLCLayout mapped to the existing RDLC file or otherwise preserve the prior default explicitly.
S3 - Correct the RU behavior in the PR description (High)
The description says RU Customer Order Summary moves its default from Word to Excel, but the current code keeps DefaultRenderingLayout = Word after the prior review finding was fixed. Update the scope and risk sections so reviewers are assessing the actual behavior.
Recommendation: Request Changes
Risk: High - current clean builds are red and one localization has an unintended tenant-facing format change.
What & why
Migrates the built-in Word report layouts to the composite (body-only) document
report structure, across BaseApp W1, the country layers, and four W1 apps.
For every report that ships a Word layout, this adds a
...Body.docxlayoutcontaining only the document body. Header, footer and theming are meant to come
from the shared header/footer and theme parts instead of being baked into each
individual layout. The existing Word layouts are kept and marked
ObsoleteState = PendingwithObsoleteTag = '32.0', so nothing breaks forcustomers using them today. Every new layout also gets a
Captionand a writtenSummaryso it is identifiable in the report layout selection UI.Scope: 128 files — 72 report objects and 56 new
.docxlayouts. 149 legacyWord layouts obsoleted, 98 body layouts added.
Please read first: the preprocessor directives are commented out
CLEAN32does not exist as a preprocessor symbol yet, so every directive aroundthe obsoleted layouts is deliberately commented out:
This keeps the legacy layouts compiling in unconditionally today, while marking
exactly where they should be excluded once
CLEAN32is introduced. There are149 such
//#if not CLEAN32///#endifpairs, all balanced. Pre-existing#if not CLEAN27/#if not CLEAN28blocks in the same files are untouched andstill live.
The same applies to the composite properties, which are present but commented out
pending platform support —
//Subtype = Body;on each body layout, and//DefaultHeaderFooterPart///DefaultThemeParton each report:DefaultRenderingLayout = "StandardSalesInvoice.docx"; //DefaultHeaderFooterPart = "External Default Detailed"; //DefaultThemePart = "BC Default";Values are written consistently as quoted names with spaces. Because they are
comments, nothing validates them yet — they will need a review when they are
enabled.
Turning this on is a mechanical follow-up: uncomment the directives and the
three properties. The
//#endiflines must be matched to their opening//#ifby nesting, not by text, since a plain
#endifmay belong to a CLEAN27/CLEAN28block.
What was changed in the localizations
Every report that a country layer overrides has been given the same treatment as
its W1 counterpart, so no layer is left with only the legacy Word layouts:
Two country reports needed more than the mechanical treatment:
NA-specific Blue and Email variants. All four legacy Word layouts are obsoleted,
and it keeps its own
StandardSalesCreditMemoNABody.docx(sales tax splitrather than VAT) instead of inheriting the W1 body layout.
DefaultRenderingLayout = Word. Since thatWord layout is now obsoleted, the default moves to the existing Excel layout,
matching the other layers.
Country layers inherit W1's
.docxthrough the layer overlay, so a layer onlyneeds its own body file where the layout genuinely differs — which is why NA is
the only layer adding one.
Two W1 reports needed a conversion rather than an addition:
WordLayout/DefaultLayoutproperties; converted to a proper
renderingsection withDefaultRenderingLayout.body layout added but their legacy Word layout was never obsoleted; now wrapped
like the rest.
Linked work
Fixes #
AB#643211
How I validated this
What I tested and the outcome
"Body-only: ..." layouts appear with their captions and summaries, and the
legacy layouts still render unchanged.
files. The report datasets are unchanged, and existing report tests cover them.
Risk & compatibility
marked
ObsoleteState = Pending/ObsoleteTag = '32.0'. Nothing is removed.//Subtype = Body;commented out, the newlayouts render as ordinary Word layouts. They become composite bodies only once
the platform support and the properties are enabled.
Word to Excel, as described above. Users who relied on the Word default get
Excel unless they select a layout explicitly.
report layout selection they have made.
CLEAN32and uncomment the directives; enable thecomposite properties and verify the header/footer and theme part names; then
remove the obsoleted layouts at
CLEAN32.