Skip to content

Features/643211/migrate existing word report layouts to composite document report structure - #10240

Draft
MSlenejennum wants to merge 180 commits into
mainfrom
features/643211/migrate-existing-word-report-layouts-to-composite-document-report-structure
Draft

Features/643211/migrate existing word report layouts to composite document report structure#10240
MSlenejennum wants to merge 180 commits into
mainfrom
features/643211/migrate-existing-word-report-layouts-to-composite-document-report-structure

Conversation

@MSlenejennum

@MSlenejennum MSlenejennum commented Aug 13, 2026

Copy link
Copy Markdown

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.docx layout
containing 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 = Pending with ObsoleteTag = '32.0', so nothing breaks for
customers using them today. Every new layout also gets a Caption and a written
Summary so it is identifiable in the report layout selection UI.

Scope: 128 files — 72 report objects and 56 new .docx layouts. 149 legacy
Word layouts obsoleted, 98 body layouts added.

Please read first: the preprocessor directives are commented out

CLEAN32 does not exist as a preprocessor symbol yet, so every directive around
the obsoleted layouts is deliberately commented out:

//#if not CLEAN32
        layout("StandardSalesInvoice.docx")
        {
            ...
            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';
        }
//#endif

This keeps the legacy layouts compiling in unconditionally today, while marking
exactly where they should be excluded once CLEAN32 is introduced. There are
149 such //#if not CLEAN32 / //#endif pairs, all balanced. Pre-existing
#if not CLEAN27 / #if not CLEAN28 blocks in the same files are untouched and
still 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 / //DefaultThemePart on 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 //#endif lines must be matched to their opening //#if
by nesting, not by text, since a plain #endif may belong to a CLEAN27/CLEAN28
block.

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:

Layer Reports
NA (8) Reminder, Standard Sales Invoice / Quote / Draft Invoice / Order Conf. / Credit Memo, Standard Statement, Standard Purchase Order
ES (6) Reminder, Standard Sales Invoice / Quote / Draft Invoice / Order Conf. / Credit Memo
FR (4) Reminder, Standard Sales Invoice / Draft Invoice / Credit Memo
NO (3) Reminder, Standard Sales Invoice, Standard Sales Quote
APAC (2) Reminder, Salesperson - Sales Statistics
DACH, FI, GB (1 each) Reminder
RU (1) Customer - Order Summary

Two country reports needed more than the mechanical treatment:

  • NA Standard Sales - Credit Memo has five Word layouts where W1 has three —
    NA-specific Blue and Email variants. All four legacy Word layouts are obsoleted,
    and it keeps its own StandardSalesCreditMemoNABody.docx (sales tax split
    rather than VAT) instead of inheriting the W1 body layout.
  • RU Customer - Order Summary had DefaultRenderingLayout = Word. Since that
    Word layout is now obsoleted, the default moves to the existing Excel layout,
    matching the other layers.

Country layers inherit W1's .docx through the layer overlay, so a layer only
needs 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:

  • Notification Email (1320) used the legacy WordLayout / DefaultLayout
    properties; converted to a proper rendering section with
    DefaultRenderingLayout.
  • Contact Cover Sheet (5085) and Inventory - Customer Sales (713) had a
    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

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

What I tested and the outcome

  • Built for — result:
  • Published to a local NST and opened the layout selection for ; the new
    "Body-only: ..." layouts appear with their captions and summaries, and the
    legacy layouts still render unchanged.
  • Ran <report(s)> against demo data and compared output against the previous layout.
  • No tests added: this change only adds report layout definitions and layout
    files. The report datasets are unchanged, and existing report tests cover them.

Risk & compatibility

  • No breaking changes. Every legacy Word layout remains available and is only
    marked ObsoleteState = Pending / ObsoleteTag = '32.0'. Nothing is removed.
  • No functional change yet. With //Subtype = Body; commented out, the new
    layouts render as ordinary Word layouts. They become composite bodies only once
    the platform support and the properties are enabled.
  • Default layout change: RU Customer - Order Summary changes its default from
    Word to Excel, as described above. Users who relied on the Word default get
    Excel unless they select a layout explicitly.
  • Upgrade/data impact: none. No table or field changes, and users keep any
    report layout selection they have made.
  • Follow-ups: introduce CLEAN32 and uncomment the directives; enable the
    composite properties and verify the header/footer and theme part names; then
    remove the obsoleted layouts at CLEAN32.

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)
…voice (Word)

CP0529-385 reportextension 6299 Sales - Invoice Standard ESG Sales Invoice - Blue (Word)
@MSlenejennum
MSlenejennum requested a review from a team as a code owner August 13, 2026 19:37
@MSlenejennum
MSlenejennum marked this pull request as draft August 13, 2026 19:37
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Aug 13, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Aug 13, 2026
@github-actions github-actions Bot added Other GitHub request for other area than SCM, Finance or Integration Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction labels Aug 13, 2026
Comment thread src/Layers/RU/BaseApp/Sales/Reports/CustomerOrderSummary.Report.al Outdated
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")

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.

$\textbf{🟡\ Medium\ Severity\ —\ Upgrade}$

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:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4

@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Upgrade}$

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

@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Upgrade}$

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>
@github-actions github-actions Bot added the needs-approval Workflow runs require maintainer approval to start label Aug 13, 2026
@github-actions github-actions Bot removed the needs-approval Workflow runs require maintainer approval to start label Aug 14, 2026

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.

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.

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

Labels

AL: Apps (W1) Add-on apps for W1 Other GitHub request for other area than SCM, Finance or Integration Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants