{"title":"OnNewRecord (Page) trigger","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/triggers-auto/page/devenv-onnewrecord-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-onnewrecord-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-onnewrecord-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":"Runs after a new record is initialized, but before it is inserted as a record in the table.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":152,"chars":435},{"level":3,"title":"Parameters","slug":"parameters","at":231,"chars":356},{"level":2,"title":"Remarks","slug":"remarks","at":587,"chars":743},{"level":2,"title":"Related information","slug":"related-information","at":1330,"chars":421}],"text":"> Version: _Available or changed with runtime version 1.0._\nRuns after a new record is initialized, but before it is inserted as a record in the table.\n## Syntax\n```al\ntrigger OnNewRecord(BelowxRec: Boolean)\nbegin\n    ...\nend;\n```\n### Parameters\nBelowxRec\nType: ../../methods-auto/boolean/boolean-data-type\nThis return value indicates whether the new record is to be inserted after the last record in the table (xRec). If false, the record is to be inserted between an existing record and the last record. If true, the record is to be inserted below the last record in the table (xRec).\n## Remarks\nUse this trigger to initialize a new record or other variables on the page. This is run before users enter any data in the record.\nIf an error occurs in the trigger code a popup dialog shows an error message. When the dialog is closed, the user can enter new data.\n> IMPORTANT\n> For pages of the type Card, List, ListPlus, Document, or Worksheet, the OnNewRecord trigger is called more than once if the page is opened in the edit mode and does not have any records to display. If the page is opened in the view mode or displays a record, the trigger is called only once.\n> NOTE\n> The OnNewRecord trigger does not support calls to control add-in methods and properties because the trigger is invoked before the page is instantiated.\n## Related information\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>\nOnNewRecord (Request Page) Trigger<../requestpage/devenv-onnewrecord-requestpage-trigger>\nOnNewRecord (Request Page Extension) Trigger<../requestpageextension/devenv-onnewrecord-requestpageextension-trigger>\nOnNewRecord (Page Extension) Trigger<../pageextension/devenv-onnewrecord-pageextension-trigger>"}