{"title":"Record.FindLast() Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/record/record-findlast-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-findlast-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-findlast-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 last 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":130,"chars":48},{"level":2,"title":"Parameters","slug":"parameters","at":178,"chars":91},{"level":2,"title":"Return Value","slug":"return-value","at":269,"chars":238},{"level":2,"title":"Remarks","slug":"remarks","at":507,"chars":784},{"level":2,"title":"Example","slug":"example","at":1291,"chars":183},{"level":2,"title":"Related information","slug":"related-information","at":1474,"chars":217}],"text":"> Version: _Available or changed with runtime version 1.0._\nFinds the last record in a table based on the current key and filter.\n## Syntax\n```al\n[Ok := ]  Record.FindLast()\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 last record.\nYou should only use this method when you explicitly want to find the last record in a table/set. Do not use this method in combination with Repeat...Until.\nCalling FindLast 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 FindLast 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.FindLast then\n    Error('error message');\n```\n## Example\nThis example requires that you create a Record variable named GLEntryRec for the G/L Entry table.\n```al\n// Read the last record only.\nif GLEntryRec.FindLast then\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"}