I am attempting to use the SetAscending in Visual Studio Code for Business Central Sales Order List Page. It works to set the Sales Order "No." field to descending however it does not reset the scrollbar to the top of the page. I've tried adding it to multiple places and it sorts the page but no scrollbar update. What code could I be missing?
Places I've added it to: Sales Order List Page Extension - OnAfterGetRecord and OnAfterGetCurrRecord Sales Order List Page Events - OnOpenPageEvent, OnAfterGetRecordEvent, and OnAfterGetCurrRecordEvent
trigger OnAfterGetCurrRecord()
begin
rec.SetCurrentKey("Document Type", "No.");
rec.SetAscending("No.", false);
end
You must tell the page to navigate to the new first record.
In the OnOpenPage trigger you do the following:
Rec.SetCurrentKey("Document Type", "No.");
Rec.SetAscending("No.", false);
if Rec.FindSet() then; // use if-then to avoid error if there are no records within the filter