https://learn.microsoft.com/nb-no/dynamics365/business-central/dev-itpro/developer/methods-auto/page/page-setselectionfilter-method
Page.SetSelectionFilter(var Record) Method - Business Central | Microsoft Learn
Notes the records that the user has selected on the page, marks those records in the table specified, and sets the filter to marked only.
business centralvarrecordmethodmicrosoft