{"title":"OnFindRecord (Page) trigger","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/triggers-auto/page/devenv-onfindrecord-page-trigger/","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/triggers-auto/page/devenv-onfindrecord-page-trigger, 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/triggers-auto/page/devenv-onfindrecord-page-trigger","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":"Overrides the default page behavior and enables you to specify which record you want to display when the page opens.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":177,"chars":308},{"level":3,"title":"Parameters","slug":"parameters","at":254,"chars":231},{"level":2,"title":"Return value","slug":"return-value","at":485,"chars":128},{"level":2,"title":"Remarks","slug":"remarks","at":613,"chars":241},{"level":2,"title":"Related information","slug":"related-information","at":854,"chars":209}],"text":"> Version: _Available or changed with runtime version 1.0._\nOverrides the default page behavior and enables you to specify which record you want to display when the page opens.\n## Syntax\n```al\ntrigger OnFindRecord(Which: Text): Ok\nbegin\n    ...\nend;\n```\n### Parameters\nWhich\nType: ../../methods-auto/text/text-data-type\nText or code value with the following options:\n (a dash): First record,\n (a plus sign): Last record,\n=\\<\\>: Record defined in the Rec variable or the closest match.\n## Return value\nOk\nType: ../../methods-auto/boolean/boolean-data-type\ntrue if the specified record was found, otherwise, false.\n## Remarks\nBy default, open pages display the last record shown when the user exited the page. Use this trigger to override the default behavior and display the first record, last record, or a specific record as defined in the Rec variable.\n## Related information\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>\nOnFindRecord (Request Page) Trigger<../requestpage/devenv-onfindrecord-requestpage-trigger>"}