Filter the source record before FindFirst in Prices Overview caption#9181
Open
Franco111000 wants to merge 1 commit into
Open
Filter the source record before FindFirst in Prices Overview caption#9181Franco111000 wants to merge 1 commit into
Franco111000 wants to merge 1 commit into
Conversation
GetFilterDescription on page 7024 Prices Overview assigned the source number to a record field and called FindFirst without a filter, so the caption showed the name of the first record in the table instead of the selected one. The Customer, Customer Price Group, and Campaign branches now apply SetFilter before FindFirst. The APAC layer copy of the page carries the same code and receives the same change. The regression tests open the page in edit mode because the platform suppresses DataCaptionExpression on a view-mode page without records. Fixes microsoft#9101. Re-submission of microsoft/BusinessCentralApps#1911.
1 task
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Page 7024 "Prices Overview" builds its data caption in
GetFilterDescription()by assigning the source number to a record field and then callingFindFirst()without a filter. Assignment is not filtering, soFindFirst()returns the first record of the table and the caption shows an unrelated record's name next to the correct number. The Customer, Customer Price Group, and Campaign branches all have the defect.This change replaces the assignments with
SetFilteron the key field in all three branches, so the caption looks up the record actually selected in the Assign-to Filter. The APAC layer carries a full copy of the page with identical code and receives the same three-line change, following the practice of propagating W1 fixes to layer copies.Three regression tests cover the three branches: each creates a record whose name is not derived from its number, opens Prices Overview, sets the type and number filters, and asserts the caption contains the record's name. The tests open the page in edit mode deliberately: the platform suppresses
DataCaptionExpressionon a page opened in view mode with no records (microsoft/AL#6388), and Prices Overview starts on an empty Price List Line table in the test setup. This is also the most plausible cause of the internal test failures reported on the pilot PR, which used view mode.This is a re-submission of microsoft/BusinessCentralApps#1911 (pilot repository, retired). The fix was reviewed there and closed unmerged with a note about test failures when the repository was retired; the view-mode issue described above is corrected in this version.
Linked work
Fixes #9101
Original pilot review: microsoft/BusinessCentralApps#1911 (fixing microsoft/BusinessCentralApps#1371).
How I validated this
What I tested and the outcome
FindFirst()pattern is still present inGetFilterDescription(), byte-identical in the W1 page and the APAC layer copy, and that no other layer carries a copy.OpenEdit()for the reason described above; the page has no page-levelEditable = false, so edit mode is valid.SetFilterreplacements per page copy plus tests and relies on CI for compilation and the test run.Risk & compatibility
SourceNoFilteris a filter value entered in a filter field, so passing it toSetFilteris the intended semantics; when the filter matches several records the caption shows the first match, which is strictly better than showing an unrelated record.