{"title":"Record.FindFirst() Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/record/record-findfirst-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-findfirst-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-findfirst-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 the first record 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":49},{"level":2,"title":"Parameters","slug":"parameters","at":180,"chars":91},{"level":2,"title":"Return Value","slug":"return-value","at":271,"chars":238},{"level":2,"title":"Remarks","slug":"remarks","at":509,"chars":792},{"level":2,"title":"Example","slug":"example","at":1301,"chars":295},{"level":2,"title":"Related information","slug":"related-information","at":1596,"chars":217}],"text":"> Version: _Available or changed with runtime version 1.0._\nFinds the first record in a table based on the current key and filter.\n## Syntax\n```al\n[Ok := ]  Record.FindFirst()\n```\n## Parameters\nRecord\nType: record-data-type\nAn instance of the record-data-type data type.\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\nThis method should be used instead of Find\\('-'\\) when you only need the first record.\nYou should only use this method when you explicitly want to find the first record in a table or set. Do not use this method in combination with Repeat.. Until.\nCalling FindFirst on an empty table from the ../../triggers-auto/page/devenv-onnewrecord-page-trigger causes the Business Central Server to throw an exception, and the AL execution stops. However, the client suppresses this error and does not show any error message to the user. Therefore, when using FindFirst inside this trigger, you should add code that conditionally verifies whether a record was found, and if not, notify the user with a message. For example:\n```al\nif not MyRecord.FindFirst then\n    Error('error message');\n```\n## Example\nThis example also assumes that you have a ConfigurePost method.\n```al\nvar\n    SalesSetupRec: Record \"Sales & Receivables Setup\";\nbegin\n    // Read the first record only.\n    if SalesSetupRec.FindFirst then\n        begin\n           ConfigurePost(SalesSetupRec);\n        end;\nend;\n\n```\n## Related information\nrecord-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>\n../../../administration/optimize-sql-al-database-methods-and-performance-on-server"}