Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ page 22207 "Review G/L Entries"
begin
Rec.CalcFields("Reviewed Amount");
RemainingAmount := Rec.Amount - Rec."Reviewed Amount";
if Rec."Amount to Review" = 0 then
Rec."Amount to Review" := RemainingAmount;
Comment on lines +345 to +346
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifying Rec."Amount to Review" in OnAfterGetRecord without persisting it to the database can lead to inconsistent behavior. The CalcBalance() function (lines 402-412) iterates through all records and sums "Amount to Review", but it will only see persisted values, not the in-memory modifications made in this trigger. This means the Balance calculation may be incorrect when records have their "Amount to Review" auto-filled but not explicitly modified by the user.

Consider either:

  1. Persisting the change by calling Rec.Modify() after setting the value, or
  2. Updating CalcBalance() to account for auto-filled values that haven't been persisted
Suggested change
if Rec."Amount to Review" = 0 then
Rec."Amount to Review" := RemainingAmount;
if Rec."Amount to Review" = 0 then begin
Rec."Amount to Review" := RemainingAmount;
if not Rec.IsNew() then
Rec.Modify();
end;

Copilot uses AI. Check for mistakes.
Comment on lines +345 to +346
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new auto-fill behavior for "Amount to Review" lacks test coverage. Since the repository includes comprehensive test coverage for this page (see ReviewGLEntriesTests.Codeunit.al), a test should be added to verify that:

  1. When "Amount to Review" is 0, it gets auto-filled with RemainingAmount
  2. When "Amount to Review" is non-zero, it remains unchanged
  3. The auto-filled value is correctly used in subsequent operations

Copilot uses AI. Check for mistakes.
end;

trigger OnAfterGetCurrRecord()
Expand Down
Loading