{"title":"Record.FindSet([Boolean]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/record/record-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/record/record-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/record/record-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":131,"chars":67},{"level":2,"title":"Parameters","slug":"parameters","at":198,"chars":505},{"level":2,"title":"Return Value","slug":"return-value","at":703,"chars":238},{"level":2,"title":"Remarks","slug":"remarks","at":941,"chars":713},{"level":2,"title":"Examples","slug":"examples","at":1654,"chars":159},{"level":2,"title":"Example 1","slug":"example-1","at":1813,"chars":687},{"level":2,"title":"Example 2","slug":"example-2","at":2500,"chars":646},{"level":2,"title":"Related information","slug":"related-information","at":3146,"chars":138}],"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.\n## Syntax\n```al\n[Ok := ]  Record.FindSet([ForUpdate: Boolean])\n```\n## Parameters\nRecord\nType: record-data-type\nAn instance of the record-data-type data type.\n*[Optional] ForUpdate*\nType: ../boolean/boolean-data-type\nSet this parameter to true if you want to modify any records in the set; otherwise, set the parameter to false. If you set this parameter to true, then the records will be read with Updlock. If you set this parameter to false, then you can still modify the records in the set, but these updates will not be performed optimally. The default value is false.\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 using `IsolationLevel::UpdLock` (SQL UPDLOCK), which is an advantage if you plan to update all the rows you are finding.\nThis method works the same way as the ../recordref/recordref-findset-boolean-method.\n## Examples\nThe following examples are meant for illustration purposes of the usage of the FindSet method only and are not meant to illustrate best practices.\n## Example 1\nThis example shows how to use the FindSet method to loop through a set without updating it, only running a validation on each record. This example requires a VATRegistrationValidation method, which is not included in this example:\n```al\n    procedure Example_1()\n    var\n        CompanyInformation: Record \"Company Information\";\n        Customer: Record Customer;\n    begin\n        CompanyInformation.Get();\n        Customer.SetFilter(\"Country/Region Code\", '<>%1', CompanyInformation.\"Country/Region Code\");\n        if Customer.FindSet(false) then\n            repeat\n                Customer.VATRegistrationValidation();\n            until Customer.Next() = 0;\n    end;\n```\n## Example 2\nThis example shows how to use the FindSet method to loop through a set and update a field.\n```al\n    procedure Example_2()\n    var\n        Customer: Record Customer;\n        SalesHeader: Record \"Sales Header\";\n    begin\n        Customer.FindFirst();\n        SalesHeader.SetRange(\"Sell-to Customer No.\", Customer.\"No.\");\n        SalesHeader.SetFilter(\"Bill-to Customer No.\", '<>%1', Customer.\"No.\");\n        if SalesHeader.FindSet(true) then\n            repeat\n                SalesHeader.\"Ship-to contact\" := SalesHeader.\"Bill-to Contact\";\n                SalesHeader.Modify();\n            until SalesHeader.Next() = 0;\n    end;\n```\n## Related information\nrecord-data-type\nGetting Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}