{"title":"RecordRef.FindSet([Boolean]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/recordref/recordref-findset-boolean-method/","by":"JOP-AL","license":"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/recordref/recordref-findset-boolean-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.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/recordref/recordref-findset-boolean-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Finds a set of records in a table based on the current key and filter.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":185,"chars":70},{"level":2,"title":"Parameters","slug":"parameters","at":255,"chars":387},{"level":2,"title":"Return Value","slug":"return-value","at":642,"chars":238},{"level":2,"title":"Remarks","slug":"remarks","at":880,"chars":667},{"level":2,"title":"Example","slug":"example","at":1547,"chars":1194},{"level":2,"title":"Related information","slug":"related-information","at":2741,"chars":141}],"text":"> Version: _Available or changed with runtime version 1.0._\nFinds a set of records in a table based on the current key and filter. FINDSET can only retrieve records in ascending order.\n## Syntax\n```al\n[Ok := ]  RecordRef.FindSet([ForUpdate: Boolean])\n```\n## Parameters\nRecordRef\nType: recordref-data-type\nAn instance of the recordref-data-type data type.\n*[Optional] ForUpdate*\nType: ../boolean/boolean-data-type\nSet this parameter to false if you do not want to modify any records in the set. Set this parameter to true if you want to modify records in the set. If you set this parameter to true, then the records will be read with Updlock.\n## Return Value\n*[Optional] Ok*\nType: ../boolean/boolean-data-type\ntrue if the operation was successful; otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.\n## Remarks\nYou should use this method only when you explicitly want to loop through a recordset. You should only use this method in combination with repeat..until.\nThe difference between `Find()` and FindSet is that Find uses paging and the method only requests N rows in the first request, and then if you need more rows, it'll submit a new SQL request. The FindSet method will request all rows at once.\nThe difference between `FindSet(false)` and `FindSet(true)` is that `FindSet(true)` reads the records with Updlock, which is an advantage if you plan to update all the rows you find.\nThis method works the same way as the ../record/record-findset-boolean-method.\n## Example\nThe following example opens table 18 Customer as a RecordRef variable that is named MyRecordRef. The recordref-field-method creates a FieldRef variable that is named MyFieldRef with the first field \\(No.\\). The ../fieldref/fieldref-setfilter-method uses the MyFieldRef variable to set a filter that selects records from 30000 to 32000. `MyRecordRef.Field(2)` creates a FieldRef for the second field \\(Name\\). The FindSet method finds the set of records based on the key and the filters that have been set. The ForUpdate parameter is set to False. This makes the records in the set read-only. The record ID and name of each customer in the record set is displayed in a message box until no records are left in the record set.\n```al\nvar\n    MyRecordRef: RecordRef;\n    MyFieldRef: FieldRef;\n    Text000: Label '%1: \"%2\" is found in the set of records.';\nbegin\n    MyRecordRef.Open(18);\n    MyFieldRef := MyRecordRef.Field(1);\n    MyFieldRef.SetFilter('30000..32000');\n    MyFieldRef := MyRecordRef.Field(2);\n    if MyRecordRef.FindSet(False) then begin\n      repeat\n        Message(Text000 , MyRecordRef.RecordId, MyFieldRef.Value);\n      until MyRecordRef.Next = 0;\n    end;\nend;\n```\n## Related information\nrecordref-data-type\nGetting Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}