Skip to content

[Master] - Vendor Subscription Contract Deferral Release fails with “Gen. Journal Template does not exist (Name = '')”#8254

Open
DhavalMore88 wants to merge 7 commits into
microsoft:mainfrom
DhavalMore88:bugs/Bug-636197-Master-Vendor-Subscription-Contract-Deferral-Release-fails
Open

[Master] - Vendor Subscription Contract Deferral Release fails with “Gen. Journal Template does not exist (Name = '')”#8254
DhavalMore88 wants to merge 7 commits into
microsoft:mainfrom
DhavalMore88:bugs/Bug-636197-Master-Vendor-Subscription-Contract-Deferral-Release-fails

Conversation

@DhavalMore88
Copy link
Copy Markdown
Contributor

@DhavalMore88 DhavalMore88 commented May 20, 2026

AB#636197

Bug 636197: [master] [ALL-E] Vendor Subscription Contract Deferral Release fails with “Gen. Journal Template does not exist (Name = '')”

@github-actions github-actions Bot added AL: Apps (W1) Add-on apps for W1 From Fork Pull request is coming from a fork labels May 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Issue #636197 is not valid. Please make sure you link an issue that exists, is open and is approved.

@DhavalMore88 DhavalMore88 marked this pull request as ready for review May 20, 2026 20:05
@DhavalMore88 DhavalMore88 requested a review from a team as a code owner May 20, 2026 20:05
@github-actions github-actions Bot added the Linked Issue is linked to a Azure Boards work item label May 20, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone May 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Style} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

PostGenJnlLine implicitly depends on prior Get()

ServiceContractSetup is a report-level variable loaded by GetGeneralLedgerSetupAndCheckJournalTemplateAndBatch(), but PostGenJnlLine() uses it directly for Journal Template Name and Journal Batch Name without its own Get() or nil guard. Any caller invoking PostGenJnlLine without first calling GetGeneralLedgerSetupAndCheckJournalTemplateAndBatch will silently post journal entries with blank template and batch names.

Recommendation:

  • Add ServiceContractSetup.Get() at the top of PostGenJnlLine() (or call it from a shared initialization procedure), so the procedure is self-contained and not reliant on implicit call ordering.
procedure PostGenJnlLine(var InputTempGenJournalLine: Record "Gen. Journal Line" temporary; InputPostingDate: Date; SourceCodeSetupContractDeferralsRelease: Code[10])
var
    GenJnlLine: Record "Gen. Journal Line";
begin
    if not ServiceContractSetup.FindFirst() then
        ServiceContractSetup.Get();
    GenJnlLine.Init();
    GenJnlLine."Journal Template Name" := ServiceContractSetup."Def. Rel. Jnl. Template Name";

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

djukicmilica
djukicmilica previously approved these changes May 21, 2026
@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.

Comment thread src/Apps/W1/Subscription Billing/Test/Deferrals/VendorDeferralsTest.Codeunit.al Outdated
djukicmilica
djukicmilica previously approved these changes May 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Performance} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

IsNullGuid lazy-load check may always evaluate true

IsNullGuid(ServiceContractSetup.SystemId) is used to guard a Get() call, but if ServiceContractSetup is a local procedure variable (as its declaration context suggests), it is always a fresh empty record on each invocation, so the guard is always true. This results in an unconditional Get() even when Journal Templ. Name Mandatory is false, adding an unnecessary database read on every call.

Recommendation:

  • If the intent is to lazily load the record only once per report run, declare ServiceContractSetup at the report DataSet/global level where state persists across trigger calls. If it is local, remove the guard and call Get() directly — or conditionally load only when Journal Templ. Name Mandatory is true.
// Option A: always load locally
ServiceContractSetup.Get();
if GeneralLedgerSetup."Journal Templ. Name Mandatory" then begin
    ServiceContractSetup.TestField("Def. Rel. Jnl. Template Name");
    ServiceContractSetup.TestField("Def. Rel. Jnl. Batch Name");
end;

// Option B: keep original conditional load
if GeneralLedgerSetup."Journal Templ. Name Mandatory" then begin
    ServiceContractSetup.Get();
    ServiceContractSetup.TestField("Def. Rel. Jnl. Template Name");
    ServiceContractSetup.TestField("Def. Rel. Jnl. Batch Name");
end;

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

@DhavalMore88 DhavalMore88 requested a review from djukicmilica May 26, 2026 08:23
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 From Fork Pull request is coming from a fork Linked Issue is linked to a Azure Boards work item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants