Skip to content

[Report Filename Manager] New app for configurable report output file names - Slice 651696 [vendor work] - #12610

Open
anordmann wants to merge 10 commits into
mainfrom
features/651696-Report-Filename-Manager
Open

anordmann wants to merge 10 commits into
mainfrom
features/651696-Report-Filename-Manager

Conversation

@anordmann

@anordmann anordmann commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

… names - Slice 651696 [vendor work]

What & why

Adds a new W1 app, Report Filename Manager, with its test app.

An administrator configures a file name pattern, for example Invoice-[No.]-[Sell-to Customer No.], and one pattern names a report's output on every route: print, preview, save, download, email, Attach as PDF, Send to Disk, the electronic document and its PDF & electronic document zip, scheduled output, the Report Inbox and financial reports. Setup reads compiled metadata only, so it behaves the same in an empty company.

The app changes no Base Application code. It reaches each naming point through platform and Base Application events. Where no suitable event exists, the app carries a clearly marked stand-in until Microsoft adds one (see below).

Linked work

AB#651696

No GitHub issue exists; the work is tracked in the ADO slice above.

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. (Builds with no errors under BCApps' rulesets. Remaining warnings: AA0247 (no namespace yet - see Risk) and five AA0210 in test code.)
  • 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

  • Developed and proven in a BC 28.4 container: 145 of 145 tests passed. Deliberately breaking the Preview naming made 16 proof tests fail with the expected verdicts.
  • In this repo: both apps compile against the local 29.0 symbols with CodeCop, AppSourceCop, PerTenantExtensionCop and UICop under base.ruleset.json. I have not yet compiled them against 30.0; this PR's CI is the first 30.0 build.
  • On a local 29.0 dev server: 134 of 145 tests pass. The 11 failures depend on data or languages the local CRONUS company does not have: no sales quotes, no issued reminders, no Danish language app, fewer than 100 English posted invoices. Four of them (TheMaximalPatternIsIdenticalOnEveryRoute, AnotherSubscribersNameIsNotOverridden, AnOrdinaryUserIsNamedByThePattern, AnApiPdfIsNamedByThePatternOfTheDocumentItRenders) are still being investigated.
  • The Excel stand-in (ask 4) has no automated test because it takes over a client download. It was verified by hand in the container: with it, Open in Excel (using layout) on ACC-CAT downloads as Account Categories overview-2026-09-28.xlsx; without it, as ACC-CAT.xlsx.

Stand-ins until Base Application adds an event

Each stand-in is marked in its object's header and is removed when the ask is met.

Ask Stand-in in the app until it is met
4 Excel from a financial report's overview: the overview records the report, and Report Filename Excel Sub. takes File Management's download over. Because DownloadHandler is Scope('OnPrem'), the app targets OnPrem; with the event it can target Cloud.
5 Report Inbox download, for the user's own stored entry only. OneDrive open and share keep Business Central's name until then.
6 The app's copy of Reminder Communication's rule for when a reminder keeps its own File Name.
7 Vendor Send to Disk: the app makes the same download under the pattern's name.

What waits for the platform

  • Ask 1: a report's name and labels in the language the document is rendered in. Until then, [Report Name] can come out in a different language from a document whose language has no translation installed.
  • Ask 2: printers (Universal Print, Send to Email Printer) name the file after the report caption.
  • Ask 3: the browser's Save as PDF proposes the report or page title.

Asks 4-7 are for the Base Application owners; asks 1-3 for the platform reporting owners. Background reading for review is attached below: Design Overview (one-pager), Design, Technology, and Microsoft Asks, with use cases and measurements.

Risk & compatibility

  • New app only. No changes to existing apps beyond registering it in build/projects.json, build/groups.json and the W1 AL-Go settings.
  • Object IDs are temporary (app 50110-50149, tests 50150-50179 and 50190-50199) and need Microsoft ranges.
  • No namespace yet (AA0247 warnings); happy to add one once the owning team picks it.
  • Target OnPrem, needed by the ask 4 stand-in only.
  • Test translations: the tests that prove language handling rely on Danish and German translations of the test app. BCApps ignores .xlf files, so they are not included, and those tests will fail in CI until translations are provided another way.
  • Destructive tests: the test app deletes every Report Filename Pattern row to isolate its own. A guard refuses to run on a SaaS environment that is not a sandbox.
  • Internal comments recording measurements and design history are kept in the code on purpose, to help review.

Report Filename Manager Technology.pdf
Report Filename Manager Design Overview.pdf
Report Filename Manager Platform and Application Asks.pdf
Report Filename Manager Design.pdf

@github-actions github-actions Bot added Build: scripts & configs Build scripts and configuration files AL: Apps (W1) Add-on apps for W1 Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction Team: Other GitHub request for other area than SCM, Finance or Integration labels Oct 9, 2026
@github-actions github-actions Bot added this to the Version 30.0 milestone Oct 9, 2026
Comment thread src/Apps/W1/ReportFilenameManager/App/src/table/ReportFilenamePattern.Table.al Outdated
Comment thread src/Apps/W1/ReportFilenameManager/App/src/table/ReportFilenamePattern.Table.al Outdated
Comment thread src/Apps/W1/ReportFilenameManager/App/src/table/ReportFilenamePattern.Table.al Outdated
Comment thread src/Apps/W1/ReportFilenameManager/App/src/table/ReportFilenameSetup.Table.al Outdated
Comment thread build/projects/Apps W1/.AL-Go/settings.json
Comment thread build/projects.json Outdated
Comment thread build/groups.json
"groups": [
{
"name": "AllExtensions",
"doNotInstall": true

@gggdttt Wenjie Fan (gggdttt) Oct 12, 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.

[TODO] For me to check later during integration: confirm whether doNotInstall: true is needed for the test app in all five groups, and verify which pipeline installs and runs the tests. No action needed from the vendor now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks. For context, doNotInstall is set because the test app depends on Permissions Mock. Sustainability Tests and Excise Taxes Tests have the same dependency and are installed in all five groups, in case that helps.

@anordmann

Copy link
Copy Markdown
Contributor Author

A few changes in this push that didn't come from your comments:

  • Report Filename Patterns: the "No file name patterns are set up" notification stayed after you added a pattern from the list. It now goes away once there's a pattern. New test: Filename Review Tests.ThePatternsListWithdrawsItsEmptyNoticeOnceAPatternIsAdded.
  • Report Filename Setup: Enabled Patterns didn't update after you closed the patterns list until you refreshed. The setup now recounts when the list closes. New test: Filename Review Tests.TheSetupCountsEnabledPatternsAgainWhenThePatternsListCloses.
  • I removed 18 procedures from the app that only the tests used: 17 that returned message texts for the tests to compare with, and Report Filename Context.ClearRenderedDocument. The tests now keep their own copies of the texts in the new test codeunit Filename Expected Texts. Three things had to stay because a test can't reach them any other way: Report Filename Context.ForgetExtensionCasing and the internal events Report Filename Subscribers.OnAfterNamingDelivery and Report Filename Inbox Mgt.OnBeforeDownloadWithResolvedName. They're marked FOR TESTS ONLY with the reason.
  • The tests now create all the data they use (customers, items, invoices, quotes, reminders, financial reports and so on) through the new test codeunit Filename Test Data, instead of relying on the demo company's documents. Before this, 11 tests failed on a company without, for example, sales quotes or issued reminders. Now all 168 pass on a local 29.0 server. I removed Filename Proof Build Rmdr and Filename Proof Seed Perm, which only prepared data for the old tests.

None of this changes how files are named. I've also attached a short note on hardening that goes beyond your comments, mainly how the naming context is set and cleared, so you can push back on any of it.

Report-Filename-Manager-Hardening-Note_20261014.pdf

@anordmann

Copy link
Copy Markdown
Contributor Author

Here's what has changed since I wrote the PR description:

  • Build: the five AA0210 warnings in the test code are fixed. AA0247 (no namespace yet) is the only warning left.
  • Tests: all 168 tests now pass on a local 29.0 server; the description says 134 of 145. The difference is 23 new tests, most of them for your review comments. The 11 failures are gone because the tests now create all the data they use instead of relying on the demo company, and the two that needed Danish and German Base Application translations no longer depend on them.
  • Stand-ins: ask 7 in the table is withdrawn. Vendor Send to Disk no longer makes its own download; the app now names that file in Electronic Document Format.OnBeforeGetAttachmentFileName, like the PDF in a PDF & Electronic Document zip. That adds ask 8: a way to read the name GetAttachmentFileName would give, including its extension case, without raising its event. Until then the app compares names against a default rebuilt from a copy of GetAttachmentFileName's format string, and writes the vendor file's extension in lower case.
  • Asks: so asks 4, 5, 6 and 8 are now for the Base Application owners, and asks 1-3 are still for the platform reporting owners.
  • Object IDs: the test app now uses 50150-50187 and 50190-50199.

I've attached updated versions of the four documents linked in the description: Design Overview, Design, Technology, and Platform and Application Asks.

Report-Filename-Manager-OnePager_20261014.pdf

Report-Filename-Manager-Design_20261014.pdf

Report-Filename-Manager-Technology_20261014.pdf

Report-Filename-Manager-Microsoft-Asks_20261014.pdf

@gggdttt

Copy link
Copy Markdown
Contributor

Could you simplify the comments across the app and tests? The code and method names are mostly clear already. Please remove comments that repeat the code, explain obvious parameters, or record naming discussions and development history. Keep short comments for non-obvious behavior, compatibility constraints, and temporary workarounds. Longer investigation notes can stay in the design documents.

@anordmann

Copy link
Copy Markdown
Contributor Author

Could you simplify the comments across the app and tests? The code and method names are mostly clear already. Please remove comments that repeat the code, explain obvious parameters, or record naming discussions and development history. Keep short comments for non-obvious behavior, compatibility constraints, and temporary workarounds. Longer investigation notes can stay in the design documents.

Done. I removed comments that repeated the code or restated parameter names, plus the naming discussions and development history, across the app and the tests. What's left are short notes on non-obvious behaviour, compatibility constraints (such as BaseApp 29 writing extensions upper case and 30 lower case), and the temporary workarounds, with the ask number where there is one. I also checked what remains against the BaseApp source and Microsoft Learn and corrected what didn't hold. These are comment changes only; all 169 tests still pass.

Move application IDs to 43000-43099 and test IDs to 149500-149599. Update the Report Inbox extension field and manifest ranges without changing behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@gggdttt
Wenjie Fan (gggdttt) marked this pull request as ready for review October 20, 2026 13:44
@gggdttt
Wenjie Fan (gggdttt) requested a review from a team October 20, 2026 13:44
@gggdttt
Wenjie Fan (gggdttt) requested a review from a team as a code owner October 20, 2026 13:44
Wenjie Fan (Business Central) and others added 2 commits October 20, 2026 15:46
Use Microsoft.Foundation.Reporting.FileNaming for the app and Microsoft.Test.Foundation.Reporting.FileNaming for tests. Add per-file namespace imports without changing object IDs or behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add the app and tests to the 22 country AL-Go configurations generated by Update-CountryProjectSettings.ps1, retaining existing formatting. All 23 country projects pass -Validate.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread src/Apps/W1/ReportFilenameManager/App/src/page/ReportFilenamePreview.Page.al Outdated
Comment thread src/Apps/W1/ReportFilenameManager/App/src/page/ReportFilenamePatternCard.Page.al Outdated
Comment thread src/Apps/W1/ReportFilenameManager/App/src/page/ReportFilenamePatternCard.Page.al Outdated
Comment thread src/Apps/W1/ReportFilenameManager/App/src/page/ReportFilenamePatterns.Page.al Outdated
"allowDownloadingSource": true,
"includeSourceInSymbolFile": true
},
"target": "OnPrem",

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\ —\ AppSource}$

The app manifest targets OnPrem, so this package cannot be submitted or deployed as an AppSource cloud app. Set target to Cloud and remove or replace any OnPrem-only APIs before submission.

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

local procedure ExpectExcelExportForgotten(var ReportFilenameContext: Codeunit "Report Filename Context"; Situation: Text)
begin
if ReportFilenameContext.IsExcelExportRunning() then
Error(ExcelStateErr, Situation + ', yet the export still counts as running');

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\ —\ Style}$

The Error call builds an argument by concatenating strings and values before passing it to the error template. Pass the format label and each value as separate Error parameters, using a label-backed format where needed, so translation and diagnostic analysis retain the message template.

Knowledge:

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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@microsoft-github-policy-service

Copy link
Copy Markdown

anordmann please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"
Contributor License Agreement

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
and conveys certain license rights to Microsoft Corporation and its affiliates (“Microsoft”) for Your
contributions to Microsoft open source projects. This Agreement is effective as of the latest signature
date below.

  1. Definitions.
    “Code” means the computer software code, whether in human-readable or machine-executable form,
    that is delivered by You to Microsoft under this Agreement.
    “Project” means any of the projects owned or managed by Microsoft and offered under a license
    approved by the Open Source Initiative (www.opensource.org).
    “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any
    Project, including but not limited to communication on electronic mailing lists, source code control
    systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of
    discussing and improving that Project, but excluding communication that is conspicuously marked or
    otherwise designated in writing by You as “Not a Submission.”
    “Submission” means the Code and any other copyrightable material Submitted by You, including any
    associated comments and documentation.
  2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any
    Project. This Agreement covers any and all Submissions that You, now or in the future (except as
    described in Section 4 below), Submit to any Project.
  3. Originality of Work. You represent that each of Your Submissions is entirely Your original work.
    Should You wish to Submit materials that are not Your original work, You may Submit them separately
    to the Project if You (a) retain all copyright and license information that was in the materials as You
    received them, (b) in the description accompanying Your Submission, include the phrase “Submission
    containing materials of a third party:” followed by the names of the third party and any licenses or other
    restrictions of which You are aware, and (c) follow any other instructions in the Project’s written
    guidelines concerning Submissions.
  4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else
    for whom You are acting in making Your Submission, e.g. as a contractor, vendor, or agent. If Your
    Submission is made in the course of Your work for an employer or Your employer has intellectual
    property rights in Your Submission by contract or applicable law, You must secure permission from Your
    employer to make the Submission before signing this Agreement. In that case, the term “You” in this
    Agreement will refer to You and the employer collectively. If You change employers in the future and
    desire to Submit additional Submissions for the new employer, then You agree to sign a new Agreement
    and secure permission from the new employer before Submitting those Submissions.
  5. Licenses.
  • Copyright License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license in the
    Submission to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute
    the Submission and such derivative works, and to sublicense any or all of the foregoing rights to third
    parties.
  • Patent License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under
    Your patent claims that are necessarily infringed by the Submission or the combination of the
    Submission with the Project to which it was Submitted to make, have made, use, offer to sell, sell and
    import or otherwise dispose of the Submission alone or with the Project.
  • Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement.
    No additional licenses or rights whatsoever (including, without limitation, any implied licenses) are
    granted by implication, exhaustion, estoppel or otherwise.
  1. Representations and Warranties. You represent that You are legally entitled to grant the above
    licenses. You represent that each of Your Submissions is entirely Your original work (except as You may
    have disclosed under Section 3). You represent that You have secured permission from Your employer to
    make the Submission in cases where Your Submission is made in the course of Your work for Your
    employer or Your employer has intellectual property rights in Your Submission by contract or applicable
    law. If You are signing this Agreement on behalf of Your employer, You represent and warrant that You
    have the necessary authority to bind the listed employer to the obligations contained in this Agreement.
    You are not expected to provide support for Your Submission, unless You choose to do so. UNLESS
    REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, AND EXCEPT FOR THE WARRANTIES
    EXPRESSLY STATED IN SECTIONS 3, 4, AND 6, THE SUBMISSION PROVIDED UNDER THIS AGREEMENT IS
    PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF
    NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
  2. Notice to Microsoft. You agree to notify Microsoft in writing of any facts or circumstances of which
    You later become aware that would make Your representations in this Agreement inaccurate in any
    respect.
  3. Information about Submissions. You agree that contributions to Projects and information about
    contributions may be maintained indefinitely and disclosed publicly, including Your name and other
    information that You submit with Your Submission.
  4. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and
    the parties consent to exclusive jurisdiction and venue in the federal courts sitting in King County,
    Washington, unless no federal subject matter jurisdiction exists, in which case the parties consent to
    exclusive jurisdiction and venue in the Superior Court of King County, Washington. The parties waive all
    defenses of lack of personal jurisdiction and forum non-conveniens.
  5. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and
    supersedes any and all prior agreements, understandings or communications, written or oral, between
    the parties relating to the subject matter hereof. This Agreement may be assigned by Microsoft.

begin
foreach Value in Values do begin
if Rendered <> '' then
Rendered += Separator;

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\ —\ Performance}$

Joined repeatedly mutates a Text value while traversing the configured values list, creating a new text value for each separator and value. Use a TextBuilder and convert once after the loop to avoid repeated allocations as the number of values grows.

Knowledge:

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


// Commit between proofs so a later failure does not roll back earlier log entries.
ProveRouteIndependence();
Commit();

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{🟠\ High\ Severity\ —\ Testing}$

The proof codeunit commits between its scenarios, but the Subtype = Test methods that invoke it do not declare TransactionModel::AutoCommit. Under the default AutoRollback transaction model, the first Commit can terminate the test instead of producing a business-logic verdict. Mark the invoking commit-driven tests AutoCommit and run them under a TestIsolation-enabled runner so the committed setup does not leak between tests.

Knowledge:

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

This branch was successfully deployed

1 active (outdated) deployment
triage — 0dd86817 Deployed Oct 20, 2026 by gggdttt via Classify team ownership #8442
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 Build: scripts & configs Build scripts and configuration files Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction Team: Other GitHub request for other area than SCM, Finance or Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants