Skip to content

[Master]-Vendor Order No. exceeds 20-character limit causing error in Intercompany Purchase Invoice#9204

Merged
neeleshsinghal merged 5 commits into
mainfrom
bugs/-Bug-641567-Vendor-Order-No-more-than-20-words-Intercompany-Purchase-Inv
Jul 10, 2026
Merged

[Master]-Vendor Order No. exceeds 20-character limit causing error in Intercompany Purchase Invoice#9204
neeleshsinghal merged 5 commits into
mainfrom
bugs/-Bug-641567-Vendor-Order-No-more-than-20-words-Intercompany-Purchase-Inv

Conversation

@neeleshsinghal

@neeleshsinghal neeleshsinghal commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Fixes AB#641567

Workitem :- Bug 641567: [All-e]Master][SaaS] Vendor Order No. exceeds 20-character limit causing error in Intercompany Purchase Invoice

@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 8, 2026
@neeleshsinghal neeleshsinghal added SCM GitHub request for SCM area From Fork Pull request is coming from a fork labels Jul 8, 2026
@neeleshsinghal neeleshsinghal requested a review from Copilot July 8, 2026 07:46

Copilot AI left a comment

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.

Pull request overview

This PR fixes a runtime error when opening an intercompany-created Purchase Invoice if "Vendor Order No." exceeds the 20-character limit of "IC Reference Document No." used in a duplicate-document lookup. The change is applied consistently across W1 and localized BaseApp layers, and is validated with new regression tests.

Changes:

  • Prevents string-length overflow by guarding the SetRange("IC Reference Document No.", Rec."Vendor Order No.") logic with a StrLen(...) <= MaxStrLen(...) check.
  • Adds automated test coverage to ensure IC-created Purchase Invoices open successfully and retain long "Vendor Order No." values.
  • Mirrors the page fix and the test in all layers that contain the relevant objects.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Layers/W1/BaseApp/Purchases/Document/PurchaseInvoice.Page.al Adds length guard to avoid overflow when filtering by IC Reference Document No.
src/Layers/RU/BaseApp/Purchases/Document/PurchaseInvoice.Page.al Same length guard fix for RU layer Purchase Invoice page.
src/Layers/NO/BaseApp/Purchases/Document/PurchaseInvoice.Page.al Same length guard fix for NO layer Purchase Invoice page.
src/Layers/NL/BaseApp/Purchases/Document/PurchaseInvoice.Page.al Same length guard fix for NL layer Purchase Invoice page.
src/Layers/NA/BaseApp/Purchases/Document/PurchaseInvoice.Page.al Same length guard fix for NA layer Purchase Invoice page.
src/Layers/IT/BaseApp/Purchases/Document/PurchaseInvoice.Page.al Same length guard fix for IT layer Purchase Invoice page.
src/Layers/FI/BaseApp/Purchases/Document/PurchaseInvoice.Page.al Same length guard fix for FI layer Purchase Invoice page.
src/Layers/ES/BaseApp/Purchases/Document/PurchaseInvoice.Page.al Same length guard fix for ES layer Purchase Invoice page.
src/Layers/CH/BaseApp/Purchases/Document/PurchaseInvoice.Page.al Same length guard fix for CH layer Purchase Invoice page.
src/Layers/BE/BaseApp/Purchases/Document/PurchaseInvoice.Page.al Same length guard fix for BE layer Purchase Invoice page.
src/Layers/APAC/BaseApp/Purchases/Document/PurchaseInvoice.Page.al Same length guard fix for APAC layer Purchase Invoice page.
src/Layers/W1/Tests/ERM/ERMIntercompanyIII.Codeunit.al Adds regression test covering opening IC-created invoice with long Vendor Order No.
src/Layers/NL/Tests/ERM/ERMIntercompanyIII.Codeunit.al Same regression test for NL test layer.
src/Layers/CZ/Tests/ERM/ERMIntercompanyIII.Codeunit.al Same regression test for CZ test layer.
src/Layers/CH/Tests/ERM/ERMIntercompanyIII.Codeunit.al Same regression test for CH test layer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@neeleshsinghal neeleshsinghal added the Linked Issue is linked to a Azure Boards work item label Jul 9, 2026
@neeleshsinghal neeleshsinghal reopened this Jul 9, 2026
@neeleshsinghal neeleshsinghal reopened this Jul 9, 2026
@neeleshsinghal neeleshsinghal marked this pull request as ready for review July 9, 2026 08:18
@neeleshsinghal neeleshsinghal requested a review from a team July 9, 2026 08:18
@neeleshsinghal neeleshsinghal added SCM GitHub request for SCM area and removed SCM GitHub request for SCM area labels Jul 9, 2026
@neeleshsinghal neeleshsinghal requested a review from Copilot July 9, 2026 08:19

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Comment thread src/Layers/NO/BaseApp/Purchases/Document/PurchaseInvoice.Page.al Outdated
Comment thread src/Layers/IT/BaseApp/Purchases/Document/PurchaseInvoice.Page.al Outdated
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 3 · Outcome: completed

All sub-skills ran to completion or determined the diff was out of their declared scope; no violations of BCQuality guidance were found and no cross-cutting defect cleared the agent-finding precision bar.

Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630

Orchestrator pre-filter (13 file(s) excluded)

  • layer-disabled (knowledge) : 13 file(s)

Findings produced by the Copilot CLI agent against BCQuality at 822cae1b2771ac25f665f73369f69093bd4fd630. Reply 👎 on any inline comment to flag false positives.

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 1

Recommendation: Accept with Suggestions

What this PR does

This PR fixes opening an IC-created Purchase Invoice when Vendor Order No. is longer than the 20-character IC Reference Document No. field used for duplicate lookup. The fix does not truncate the value and does not extend the schema field; it skips that lookup when the value cannot fit, while leaving the later original-order warning path in place.

That is the safer choice here. Truncating could match the wrong document, and extending IC Reference Document No. would be a schema compatibility change. The added regression test opens the Purchase Invoice page on an IC-created invoice with a 35-character Vendor Order No. and verifies the value is retained.

Suggestions

S1 - Remove the added UTF-8 BOMs
The IT and NO PurchaseInvoice.Page.al files now start with a BOM character. Please save them without that extra character so the diff only contains the code change.

Risk assessment and necessity

Risk: Functional risk is low. The change only guards a duplicate-document lookup that could not safely run for values longer than the target Code[20] field. No data is truncated, and no field length is changed. The repeated page changes are consistent across the touched copies; the only non-functional risk is the added BOM in two files.

Necessity: The work item describes a real customer path where reopening the IC purchase invoice fails with a string-length error and no workaround. The fix is needed, narrow, and covered by a regression test for the affected page path.


[AI-PR-REVIEW] version=1 system=github pr=9204 round=1 by=alexei-dobriansky sha=01e4fc691c3782c32e5784ba967c527910e29224

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

@neeleshsinghal please clean the localizations

neeleshsinghal and others added 3 commits July 9, 2026 18:45
…-Bug-641567-Vendor-Order-No-more-than-20-words-Intercompany-Purchase-Inv
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 2

Recommendation: Accept

What this PR does

Since round 1, the PR merged main and then added two non-merge commits. Those two commits remove the added UTF-8 BOMs from the NO and IT PurchaseInvoice.Page.al files. The functional fix for opening an IC Purchase Invoice with a long Vendor Order No. is unchanged.

Status of previous suggestions
ID Title Status Author response
S1 Remove the added UTF-8 BOMs Addressed No reply; fixed in df770952c265e0621ac1f7377d9c8aee858c869c and c1b111a9147a236595e2dc017f16ae5430036207.
New observations (commits since round 1)

None - changes only addressed the previous suggestion.

Risk assessment and necessity

Risk: The round-2 non-merge changes are non-functional. They only remove file BOM bytes from the NO and IT purchase invoice page files, so they do not change runtime behavior.

Necessity: The cleanup is needed to keep the PR diff limited to the intended Business Central fix. The original bug scenario remains valid and the functional scope remains narrow.


[AI-PR-REVIEW] version=1 system=github pr=9204 round=2 by=alexei-dobriansky sha=c1b111a9147a236595e2dc017f16ae5430036207

@neeleshsinghal neeleshsinghal enabled auto-merge July 10, 2026 03:46
@neeleshsinghal neeleshsinghal added this pull request to the merge queue Jul 10, 2026
Merged via the queue into main with commit fe8ce68 Jul 10, 2026
476 of 495 checks passed
@neeleshsinghal neeleshsinghal deleted the bugs/-Bug-641567-Vendor-Order-No-more-than-20-words-Intercompany-Purchase-Inv branch July 10, 2026 14:39
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 Linked Issue is linked to a Azure Boards work item SCM GitHub request for SCM area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants