[master] - Posting service order without External document no. will copy the 'Service Order No.' to GL entries#8897
Conversation
| ServiceInvoiceHeader.FindFirst(); | ||
| GLEntry.SetRange("Document Type", GLEntry."Document Type"::Invoice); | ||
| GLEntry.SetRange("Document No.", ServiceInvoiceHeader."No."); | ||
| GLEntry.FindSet(); |
There was a problem hiding this comment.
GLEntry.FindSet() is called as a standalone statement (return value discarded) immediately before a repeat…until GLEntry.Next() = 0 loop.
Because AL's repeat…until is a do-while construct it always executes the loop body at least once, regardless of whether FindSet found any records. If no GL entries exist the loop body runs once on the default (empty) GLEntry variable, GLEntry."External Document No." equals '' by default, and Assert.AreEqual('', '', …) passes vacuously. The test would silently pass even when the posting path produces no GL entries.
Recommendation:
- replace the standalone GLEntry.FindSet() call with a guarded assertion, e.g. Assert.IsTrue(GLEntry.FindSet(), 'Expected GL entries for invoice ' + ServiceInvoiceHeader."No."); before the repeat block.
Suggested fix (apply manually — could not be anchored as a one-click suggestion):
Assert.IsTrue(GLEntry.FindSet(), 'Expected GL entries to exist for posted invoice ' + ServiceInvoiceHeader."No.");
repeat
Assert.AreEqual('', GLEntry."External Document No.", 'External Document No. should be blank on G/L Entry when not specified on Service Order');
until GLEntry.Next() = 0;👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
Copilot PR ReviewIteration 1 · Outcome: completed Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630 Findings by domainFindings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).
Totals: 0 knowledge-backed · 1 agent findings. Orchestrator pre-filter (13 file(s) excluded)
Findings produced by the Copilot CLI agent against BCQuality at |
…ceorder_ExtDocNo_GLEntries
…ceorder_ExtDocNo_GLEntries
…ceorder_ExtDocNo_GLEntries
Agentic PR Review - Round 1Recommendation: Request ChangesWhat this PR doesThis PR changes service posting so a blank service SuggestionsS1 - Guard the G/L entry assertion S2 - Cover the credit memo path Risk assessment and necessityRisk: This touches service posting and the values written to G/L entries in W1, ES, IT, and NA. There is no public API signature change, but integrations and reports that read Necessity: The linked Bug 638670 / copied Bug 638182 has clear repro steps and an
|
…ceorder_ExtDocNo_GLEntries
Bug 638670: [master][ALL-E] Posting service order without External document no. will copy the 'Service Order No.' to GL entries
AB#638670