Add Remaining Amount field and calculation to General Ledger Entries Review page#29575
Add Remaining Amount field and calculation to General Ledger Entries Review page#29575Bertverbeek4PS wants to merge 1 commit intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds a "Remaining Amount" field to the General Ledger Entries page that displays the difference between the entry amount and the reviewed amount. This enables users to see how much of each G/L entry remains to be reviewed without navigating to the Review G/L Entries page.
Changes:
- Added a calculated "Remaining Amount" field to the General Ledger Entries page extension
- Implemented calculation logic in OnAfterGetRecord trigger to compute remaining amount as Amount minus Reviewed Amount
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Processing this PR. The branch is now locked 🔒 Please don't push updates unless otherwise agreed. |
JesperSchulz
left a comment
There was a problem hiding this comment.
Please take a look at the comment.
|
|
||
| trigger OnAfterGetRecord() | ||
| begin | ||
| Rec.CalcFields("Reviewed Amount"); |
There was a problem hiding this comment.
Code was flagged by agent:
Issue
CalcFields() called inside OnAfterGetRecord trigger on G/L Entry table (10M+ rows). This creates N+1 query pattern where every row displayed triggers a separate FlowField calculation query, causing severe performance degradation during page scrolling and rendering.
Recommendation
Remove explicit CalcFields() from OnAfterGetRecord. If 'Reviewed Amount' is a FlowField, bind it directly to a page field - the platform handles FlowField loading more efficiently. Ensure the FlowField's source table has a proper SIFT index (key with SumIndexFields) to optimize the aggregation. If RemainingAmount calculation is required, consider computing it only OnAfterGetCurrRecord (for the focused record) or using a query-based approach.
There was a problem hiding this comment.
@JesperSchulz
Well if I put the field on the page and people are making it invisible it would not calculate because of the feature:
" Calculate only visible FlowFields"
ANd on the OnAfterGetCurreRecord I only have the focussed record
There was a problem hiding this comment.
Feedback from the Finance team:
This feature has given us enormous performance issues, inconsistent calculation of Amount to Review and upgrade timeouts. We will not add more calculation to it. These fields are an extension on top of GL Entry - one of the biggest tables of BC with millions of records. Extremely risky to add more calculations.
Summary
Added remaining amount to the page "General Ledger Entries" as an extension. Calculate the amount minus the reviewed amount.
Fixes #29469
Fixes AB#618355