Skip to content

Copy record links to posted Phys. Invt. Order and Recording headers#9180

Open
Franco111000 wants to merge 1 commit into
microsoft:mainfrom
Franco111000:fix-9099-physinvt-copy-record-links
Open

Copy record links to posted Phys. Invt. Order and Recording headers#9180
Franco111000 wants to merge 1 commit into
microsoft:mainfrom
Franco111000:fix-9099-physinvt-copy-record-links

Conversation

@Franco111000

@Franco111000 Franco111000 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What & why

Record links (the standard Notes and Links factboxes) attached to a Phys. Invt. Order Header or a Phys. Invt. Recording Header were lost on posting: codeunit 5884 "Phys. Invt. Order-Post" never called "Record Link Management".CopyLinks, unlike the sales, purchase, and warehouse posting flows, which all carry record links over to their posted history tables.

This change copies the links in the two places where the posted headers are inserted: RecordLinkManagement.CopyLinks(PhysInvtOrderHeader, PstdPhysInvtOrderHdr) after the insert in InsertPostedHeader(), and RecordLinkManagement.CopyLinks(PhysInvtRecordHeader, PstdPhysInvtRecordHdr) after each recording header insert in InsertPostedRecordings(). Both calls sit inside the existing if not IsHandled then blocks, so subscribers that replace the standard insert keep full control. A regression test posts an order with a note on both the order and the recording and verifies the links arrive on the posted documents.

This is a re-submission of microsoft/BusinessCentralApps#1900 (pilot repository, retired). The fix and the test were reviewed there; the regression test was added at the reviewer's request. The pilot PR was closed unmerged by the repository retirement.

Linked work

Fixes #9099

Original pilot review: microsoft/BusinessCentralApps#1900 (fixing microsoft/BusinessCentralApps#1610).

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

  • Verified against current main that neither InsertPostedHeader() nor InsertPostedRecordings() references CopyLinks or Record Link Management anywhere in the codeunit, so the defect is still present.
  • New test CopyLinksOnPostingPhysInvtOrder in PhysInvtItemTracking.Codeunit.al mirrors the existing DropShipmentCopyLinksOnPostingReceiptShipment pattern: it attaches a record link to both the Phys. Invt. Order Header and the Phys. Invt. Recording Header, posts the order, and asserts both posted headers carry the link. The test was reviewed in the pilot PR.
  • Verified codeunit 5884 has no country layer copies (W1 only), so no localization propagation is needed.
  • using System.Utilities; is inserted in alphabetical position for the Record Link Management reference.
  • I did not build the Base Application locally; the change is two additive calls plus a test and relies on CI for compilation and the test run.

Risk & compatibility

  • Additive behavior only: posting output is unchanged except that record links now appear on the posted documents, matching every other posting flow.
  • The copy runs inside the existing IsHandled gates right after the standard inserts, so event subscribers that take over the insert are unaffected.
  • No schema, permission, or signature changes.

Posting a Physical Inventory Order now transfers record links (Notes
factbox) from the Phys. Invt. Order Header and Phys. Invt. Recording
Header to their posted counterparts, consistent with the other posting
flows in the Base Application.

Fixes microsoft#9099. Re-submission of microsoft/BusinessCentralApps#1900.
@Franco111000 Franco111000 requested a review from a team July 7, 2026 12:09
@github-actions github-actions Bot added From Fork Pull request is coming from a fork needs-approval Workflow runs require maintainer approval to start labels Jul 7, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

@Franco111000 please label your PRs with SCM or Finance (depends on the area you're fixing) so that we can find and review them faster :) Thanks!

@Franco111000

Copy link
Copy Markdown
Contributor Author

Sure thing @alexei-dobriansky! I tried to add the label just now but it seems I don't have label permissions on the repo, so correct me if I'm wrong on how contributors are meant to apply them. In case a maintainer can set them meanwhile, the mapping for my open PRs (mirroring each linked issue's area label) is: #9180, #9181, #9182, and #9096 are SCM, #9098 is Finance. Happy to label them myself on every future PR once I have the ability.

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

Labels

From Fork Pull request is coming from a fork needs-approval Workflow runs require maintainer approval to start

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Record links are not copied to posted Phys. Invt. Order and Recording on posting

2 participants