# Page.SetSelectionFilter(var Record) Method
> Version: _Available or changed with runtime version 1.0._
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".
## Syntax
```al
 Page.SetSelectionFilter(var Record: Record)
```
## Parameters
Page
Type: page-data-type
An instance of the page-data-type data type.
Record
Type: ../record/record-data-type
## Remarks
If all records are selected, marks won't be used.
If only the current record is selected on the page, then SetSelectionFilter does the following:
 Sets the current filter group to `0` on the destination record
 Adds filters on the primary key fields that point to the current record of the page
If more than one record is selected on the page, then SetSelectionFilter does the following:
 Copies the current key from the page source table to the destination record
 Copies the current sort order from the table to the destination record
 Copies the current filters that are set in all filter groups
 Copies the current filter group
 Marks the selected records and sets the "marked only" filter
> IMPORTANT
> SetSelectionFilter isn't directly supported on pages based on temporary source tables and must therefore be replaced with a custom page method (see Example 2 in the following).
## Example 1
The following example shows how to use the SetSelectionFilter method to update the record or records from the Contact table that the user has selected on the current page.
```al
var
    Contact: Record Contact;
    CRMIntegrationManagement: Codeunit "CRM Integration Management";
    ContactRecordRef: RecordRef;
begin
    CurrPage.SetSelectionFilter(Contact);
    Contact.Next();

    if Contact.Count = 1 then
        CRMIntegrationManagement.UpdateOneNow(Contact.RecordId)
    else begin
        ContactRecordRef.GetTable(Contact);
        CRMIntegrationManagement.UpdateMultipleNow(ContactRecordRef);
    end;
end;
```
## Example 2 (temporary records)
For retrieving selected records on pages with a temporary source table, the following example shows how to define a custom method on a page that is based on a temporary Contact table. Other objects need to call the custom method instead of the SetSelectionFilter method.
```al
procedure SetTempSelectionFilter(var TempContact: Record Contact temporary)
begin
    TempContact.Copy(Rec, true);
    CurrPage.SetSelectionFilter(TempContact);
end;
```
## Related information
page-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/page/page-setselectionfilter-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/page/page-setselectionfilter-method/
