Skip to content

[Master]-Contoso - The binding of codeunit 11489 was unsuccessful. The codeunit has already been bound. - Copy - #9971

Open
neeleshsinghal wants to merge 4 commits into
mainfrom
bugs/Bug-645158-The-binding-of-codeunit-11489-was-unsuccessful
Open

[Master]-Contoso - The binding of codeunit 11489 was unsuccessful. The codeunit has already been bound. - Copy#9971
neeleshsinghal wants to merge 4 commits into
mainfrom
bugs/Bug-645158-The-binding-of-codeunit-11489-was-unsuccessful

Conversation

@neeleshsinghal

@neeleshsinghal neeleshsinghal commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@neeleshsinghal
neeleshsinghal requested review from a team August 5, 2026 06:27
@github-actions github-actions Bot added AL: Apps (W1) Add-on apps for W1 Integration GitHub request for Integration area labels Aug 5, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Aug 5, 2026
@neeleshsinghal neeleshsinghal reopened this Aug 5, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

begin
TempContosoGLAccount.Get(AccountName);
exit(TempContosoGLAccount."Account No.");
if TempContosoGLAccount.Get(AccountName) then

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\ —\ Breaking\ Changes\ /\ Error\ Handling}$

GetAccountNo is a public procedure (called from many other codeunits: CreateFAGLAccount, CreateMfgGLAccount, CreateGLAccount, etc.) that previously guaranteed either a valid Account No. or a runtime error via TempContosoGLAccount.Get(AccountName). After this change, if the account name is not found in the temp buffer AND LoadAccountFromGLAccount also fails to find a matching G/L Account by Name, GetAccountNo falls through silently and returns an empty/default Code[20] instead of raising an error. This is a behavioral change to a published procedure's contract: callers that assumed a non-blank result or an explicit failure can now silently receive a blank account number, letting invalid/blank G/L account references propagate into demo-data setup without any error surfacing (e.g., into InsertGLAccount-adjacent calls or downstream posting-group wiring), producing confusing failures far from the actual missing-account cause. Consider re-raising an error (or returning the original TempContosoGLAccount.Get failure) when both lookups miss, or explicitly documenting/handling the blank-return case at each call site.

Suggested fix (apply manually — could not be anchored as a one-click suggestion):

    procedure GetAccountNo(AccountName: Text[100]): Code[20]
    begin
        if TempContosoGLAccount.Get(AccountName) then
            exit(TempContosoGLAccount."Account No.");

        if LoadAccountFromGLAccount(AccountName) then
            exit(TempContosoGLAccount."Account No.");

        TempContosoGLAccount.Get(AccountName);
    end;

Agent judgement — not directly backed by a BCQuality knowledge article.

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

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 (High): The linked bug is caused by manual subscribers remaining bound when demo-data generation fails. This change only avoids one specific NET INCOME lookup failure. US Contoso Localization still binds codeunit 11489 in OnBeforeGeneratingDemoData and only unbinds it in OnAfterGeneratingDemoData, so any other exception still leaves the subscriber bound and the next run fails with the same error. Please fix the binding lifecycle and add a regression test that forces generation to fail, then verifies a second run does not report an already-bound codeunit.

S2 (High): GetAccountNo previously guaranteed a valid account number or raised an explicit lookup error. If neither the temporary mapping nor a G/L Account name matches, the new implementation falls through and returns blank, allowing invalid account references to propagate. Preserve explicit failure when both lookups miss.

@neeleshsinghal

Copy link
Copy Markdown
Contributor Author

S1 (High): The linked bug is caused by manual subscribers remaining bound when demo-data generation fails. This change only avoids one specific NET INCOME lookup failure. US Contoso Localization still binds codeunit 11489 in OnBeforeGeneratingDemoData and only unbinds it in OnAfterGeneratingDemoData, so any other exception still leaves the subscriber bound and the next run fails with the same error. Please fix the binding lifecycle and add a regression test that forces generation to fail, then verifies a second run does not report an already-bound codeunit.

S2 (High): GetAccountNo previously guaranteed a valid account number or raised an explicit lookup error. If neither the temporary mapping nor a G/L Account name matches, the new implementation falls through and returns blank, allowing invalid account references to propagate. Preserve explicit failure when both lookups miss.

s1 fixed but generally test was not found for demodata
s2 fixed

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.

Reviewed the idempotent subscription-binding change for rerunning Contoso generation after an earlier failure.

@neeleshsinghal neeleshsinghal removed the Integration GitHub request for Integration area label Aug 12, 2026
@neeleshsinghal neeleshsinghal added the Integration GitHub request for Integration area label Aug 12, 2026
@neeleshsinghal
neeleshsinghal requested review from Aleyenda and a lite review from Copilot August 12, 2026 05:48

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 updates the US Contoso demo dataset localization subscriber binding logic to avoid failing when a subscriber codeunit is already bound during demo data generation.

Changes:

  • Updated OnBeforeGeneratingDemoData to call BindSubscription(...) via its Boolean-returning form (if BindSubscription(...) then;) across all modules.
  • This makes subscription binding tolerant to “already bound” situations (the likely source of the reported runtime error for codeunit 11489 / “Create Acc. Schedule Line US”).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

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

Labels

Integration GitHub request for Integration area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants