Skip to content

Bug 636248: Guard against empty No. in Subc. ProdOrderRtngLine Ext. OnAfterValidate#8674

Open
ChethanT wants to merge 1 commit into
mainfrom
fix/bug-636248-empty-no-guard
Open

Bug 636248: Guard against empty No. in Subc. ProdOrderRtngLine Ext. OnAfterValidate#8674
ChethanT wants to merge 1 commit into
mainfrom
fix/bug-636248-empty-no-guard

Conversation

@ChethanT

@ChethanT ChethanT commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The OnAfterValidate trigger on the No. field in table extension Subc. ProdOrderRtngLine Ext. (99001506) calls WorkCenter.Get(No.) without first checking if No. is empty.
  • When the Sustainability test VerifySustainabilityFieldsShouldBeUpdatedFromItemAndWorkCenter clears the No. field (validates to '' before setting a new value), this causes: The Work Center does not exist. Identification fields and values: No.=''

Root Cause

Missing empty-string guard before WorkCenter.Get(No.) in the modify(No.) trigger.

Fix

Exit early and reset Transfer WIP Item to false when No. is empty, consistent with the existing pattern for non-Work Center types.

Test

Re-enables disabled tests in codeunit 148190 Sust. Value Entry Test:

  • VerifySustainabilityFieldsShouldBeUpdatedFromItemAndWorkCenter
  • VerifySustainabilityValueEntryShouldBeCreatedWhenPurchDocumentIsPosted

Fixes AB#636248

🤖 Generated with GitHub Copilot

The OnAfterValidate trigger on the No. field in the Subc. ProdOrderRtngLine
Ext. table extension calls WorkCenter.Get(No.) without first checking if No.
is empty. When a test (or user) clears the No. field, this causes a runtime
error: 'The Work Center does not exist. Identification fields and values:
No.='''''.

Fix: Exit early and reset Transfer WIP Item to false when No. is empty,
consistent with the existing pattern for non-Work Center types.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ChethanT ChethanT requested a review from a team June 18, 2026 20:51
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Jun 18, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jun 18, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants