Skip to content

Conversation

@Bertverbeek4PS
Copy link
Contributor

@Bertverbeek4PS Bertverbeek4PS commented Nov 26, 2025

Summary

The field 'Amount to Review' will now be filled when the page is opened with the calculated field remaining amount.

Work Item(s)

Fixes #29317

Fixes AB#615546

@Bertverbeek4PS Bertverbeek4PS requested a review from a team as a code owner November 26, 2025 19:23
Copilot finished reviewing on behalf of Bertverbeek4PS November 26, 2025 19:25
Copy link

Copilot AI left a comment

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 addresses issue #29317 by auto-filling the "Amount to Review" field with the calculated remaining amount when records are displayed on the Review G/L Entries page.

Key Changes:

  • Auto-populates "Amount to Review" field when it's zero using the RemainingAmount calculation in the OnAfterGetRecord trigger

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment on lines +345 to +346
if Rec."Amount to Review" = 0 then
Rec."Amount to Review" := RemainingAmount;
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
if Rec."Amount to Review" = 0 then
Rec."Amount to Review" := RemainingAmount;
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.
@AndersLarsenMicrosoft AndersLarsenMicrosoft self-assigned this Dec 3, 2025
@JesperSchulz JesperSchulz added linked Issue is linked to a Azure Boards work item processing-PR The PR is currently being reviewed labels Dec 5, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

Processing this PR. The branch is now locked 🔒 Please don't push updates unless otherwise agreed.

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

Labels

Finance GitHub request for Finance area linked Issue is linked to a Azure Boards work item processing-PR The PR is currently being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: fill amount to review automatically with the remaining amount in Review G/L entries

3 participants