{"title":"Record.Insert(Boolean, Boolean) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/record/record-insert-boolean-boolean-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-insert-boolean-boolean-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-insert-boolean-boolean-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":"Inserts a record into a table.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":91,"chars":94},{"level":2,"title":"Parameters","slug":"parameters","at":185,"chars":666},{"level":2,"title":"Return Value","slug":"return-value","at":851,"chars":238},{"level":2,"title":"Remarks","slug":"remarks","at":1089,"chars":208},{"level":2,"title":"Example","slug":"example","at":1297,"chars":588},{"level":2,"title":"Related information","slug":"related-information","at":1885,"chars":176}],"text":"> Version: _Available or changed with runtime version 4.0._\nInserts a record into a table.\n## Syntax\n```al\n[Ok := ]  Record.Insert(RunTrigger: Boolean, InsertWithSystemId: Boolean)\n```\n## Parameters\nRecord\nType: record-data-type\nAn instance of the record-data-type data type.\nRunTrigger\nType: ../boolean/boolean-data-type\nIf this parameter is true, the code in the OnInsert Trigger is executed. If this parameter is false, the code in the OnInsert trigger is not executed. The default value is false.\nInsertWithSystemId\nType: ../boolean/boolean-data-type\nIf this parameter is true, the SystemId field of the record is given a value that you explicitly assign. If a value is not assigned, then the platform assigns one. If this parameter is false, the SystemId field is given a value that is auto-generated by the platform. The default value is false.\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\nThe inserted record will automatically get assigned a SystemId by the platform. To assign a specific SystemId instead of the one assigned by the platform, use record-insert-boolean-method instead.\n## Example\nThis example shows how to use the Insert method to insert a record with a specified SystemId.\n```al\nvar\n    CustomerRec: Record Customer;\n    Text000: Label 'Customer no: %1 inserted.';\n    Text001: Label 'Customer no: %1 already exists.';\nbegin\n    CustomerRec.Init();\n    CustomerRec.\"No.\" := '1120';\n    CustomerRec.SystemId := '{B6666666-F5A2-E911-8180-001DD8B7338E}';\n    if CustomerRec.Insert(true, true) then\n      Message(Text000, CustomerRec.\"No.\")\n    else\n      Message(Text001, CustomerRec.\"No.\");\nend;\n```\nNo run-time error occurs if customer 1120 already exists.\n## Related information\n../../devenv-table-system-fields#systemid\nrecord-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}