{"title":"Record.Find([Text]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/record/record-find-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-find-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-find-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 record in a table that is based on the values stored in keys.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Record.Find([Text]) Method","slug":"recordfindtext-method","at":0,"chars":3986},{"level":2,"title":"Syntax","slug":"syntax","at":159,"chars":57},{"level":2,"title":"Parameters","slug":"parameters","at":216,"chars":888},{"level":2,"title":"Return Value","slug":"return-value","at":1104,"chars":238},{"level":2,"title":"Remarks","slug":"remarks","at":1342,"chars":904},{"level":2,"title":"Example 1","slug":"example-1","at":2246,"chars":854},{"level":2,"title":"Example 2","slug":"example-2","at":3100,"chars":669},{"level":2,"title":"Related information","slug":"related-information","at":3769,"chars":217}],"text":"# Record.Find([Text]) Method\n> Version: _Available or changed with runtime version 1.0._\nFinds a record in a table that is based on the values stored in keys.\n## Syntax\n```al\n[Ok := ]  Record.Find([Which: Text])\n```\n## Parameters\nRecord\nType: record-data-type\nAn instance of the record-data-type data type.\n*[Optional] Which*\nType: ../text/text-data-type\nSpecifies how to perform the search. The table is searched until either a record is found or there are no more records. Each character in this string can be present only one time. You can combine the '=', '\\<', and '\\>' characters. You can use the following characters:\n =  to search for a record that equals the key values (default)\n \\>  to search for a record that is larger than the key values\n \\<  to search for a record that is less than the key values\n +  to search for the last record in the table (+ can only be used alone)\n -   to search for the first record in the table (- can only be used alone)\nIf this parameter contains '=', '\\>' or '\\<', then you must assign value to all fields of the current and primary keys before you call FIND.\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\nFind retrieves the first record that meets the conditions set by Which and the filters associated with Record. The search path reflects the sort order defined by the current key. If the current key is not the primary key, several records might have the same values in current key fields. If this occurs, the sort order defined by the primary key as the search path is used.\nCalling Find 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 Find 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.Find then\n    Error('error message');\n```\n## Example 1\nThe following example shows how use the Find method to find a record in a table. The code sets the number of the record to find to 1100, which is the primary key of the record to find. The Find method uses the '=' parameter to find the record that has a primary value that equals the specified primary key. If the record is found, then the item number, description, and unit price of the item are displayed in a message box. Otherwise, a message that specifies that the item is not found is displayed.\n```al\nbegin\n    ItemRec.\"No.\" := '1100';\n    if ItemRec.Find('=') then\n        Message(Text000, ItemRec.\"No.\", ItemRec.Description, ItemRec.\"Unit Price\")\n    else\n        Message(Text001);\nend;\n\nvar\n    ItemRec: Record Item;\n    Text000: Label 'Item No. %1.\\Description: %2. Price: $%3.';\n    Text001: Label 'The item was not found.';\n```\n## Example 2\nThe following example defines a record variable that is named ItemRec. The Find method uses the '+' parameter to find the last record in the table. If the record is found, then the item number, description, and unit price of the item are displayed in a message box. Otherwise, the message that specifies that the item was not found is displayed.\n```al\nbegin\n    if ItemRec.Find('+') then\n        Message(Text000, ItemRec.\"No.\", ItemRec.Description, ItemRec.\"Unit Price\")\n    else\n        Message(Text001);\nend;\n\nvar\n    ItemRec: Record Item;\n    Text000: Label 'Item No. %1.\\Description: %2. Price: $%3.';\n    Text001: Label 'The item was not found.';\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"}