Describe the issue
Page 7024 "Prices Overview" builds its data caption in GetFilterDescription() by assigning the source number to a record field and then calling FindFirst() without any filter:
PriceSource."Source Type"::Customer:
begin
SalesSrcTableName := ObjTranslation.TranslateObject(ObjTranslation."Object Type"::Table, 18);
Cust."No." := CopyStr(SourceNoFilter, 1, MaxStrLen(Cust."No."));
if Cust.FindFirst() then
Description := Cust.Name;
end;
Assigning to Cust."No." does not filter the record, so FindFirst() returns the first customer in the table and the caption shows an unrelated customer's name next to the correct number. The Customer Price Group and Campaign branches have the same defect.
Verified still present in current main: src/Layers/W1/BaseApp/Pricing/PriceList/PricesOverview.Page.al, GetFilterDescription(). The APAC layer copy of the page (src/Layers/APAC/BaseApp/Pricing/PriceList/PricesOverview.Page.al) contains the same pattern.
The fix is to replace the field assignments with SetFilter/SetRange on the key field before FindFirst() in all three branches.
Expected behavior
The page caption shows the name of the record actually selected in the Source No. filter.
Steps to reproduce
- Create a page action in AL that runs Prices Overview modally.
- Run the action in Business Central.
- Choose Source Type "Customer" and as Source No. any customer except the first one in the table.
- The caption shows the chosen customer's number but the first customer's name.
Additional context
This is a copy of microsoft/BusinessCentralApps#1371 (labeled Approved/SCM in the contribution pilot). It was being fixed in microsoft/BusinessCentralApps#1911, which was reviewed with regression tests added, but was closed unmerged with a note about test failures when the repository was retired. The likely cause of those failures has been identified (the tests opened the page in view mode on an empty Price List Line table, where the platform suppresses the DataCaptionExpression, see microsoft/AL#6388) and will be corrected in the re-submitted fix.
I will provide a fix for a bug
Describe the issue
Page 7024 "Prices Overview" builds its data caption in
GetFilterDescription()by assigning the source number to a record field and then callingFindFirst()without any filter:Assigning to
Cust."No."does not filter the record, soFindFirst()returns the first customer in the table and the caption shows an unrelated customer's name next to the correct number. The Customer Price Group and Campaign branches have the same defect.Verified still present in current main:
src/Layers/W1/BaseApp/Pricing/PriceList/PricesOverview.Page.al,GetFilterDescription(). The APAC layer copy of the page (src/Layers/APAC/BaseApp/Pricing/PriceList/PricesOverview.Page.al) contains the same pattern.The fix is to replace the field assignments with
SetFilter/SetRangeon the key field beforeFindFirst()in all three branches.Expected behavior
The page caption shows the name of the record actually selected in the Source No. filter.
Steps to reproduce
Additional context
This is a copy of microsoft/BusinessCentralApps#1371 (labeled Approved/SCM in the contribution pilot). It was being fixed in microsoft/BusinessCentralApps#1911, which was reviewed with regression tests added, but was closed unmerged with a note about test failures when the repository was retired. The likely cause of those failures has been identified (the tests opened the page in view mode on an empty Price List Line table, where the platform suppresses the DataCaptionExpression, see microsoft/AL#6388) and will be corrected in the re-submitted fix.
I will provide a fix for a bug