# RecordRef.Init() Method
> Version: _Available or changed with runtime version 1.0._
Initializes a record in a table.
## Syntax
```al
 RecordRef.Init()
```
## Parameters
RecordRef
Type: recordref-data-type
An instance of the recordref-data-type data type.
## Remarks
This method assigns default values to each field in the record, including the SystemId field. The values that are assigned in the record correspond to those defined when the table was created. If no value was assigned when the table was created, the values are assigned based on the data type, as shown in the following table.
Data type|Default value
BigInteger|0
BigText|\<Empty>
BLOB|\<Empty>
Boolean|No
Code|'' \(empty string\)
Date|0d \(Undefined date\)
DateFormula|'' \(empty string\)
DateTime|0DT \(Undefined datetime\)
Decimal|0.0
Duration|0
GUID|00000000-0000-0000-0000-000000000000
Integer|0
Option|0
RecordID|\<Empty>
TableFilter|\<Empty>
Text|'' \(empty string\)
Time|0T \(Undefined time\)
> NOTE
> Primary key and timestamp fields are not initialized.
After the method runs, you can change the values in any or all of the fields before you call the recordref-insert--method to enter the record in the table. Be sure that the fields that make up the primary key contain values that make the total primary key unique. If the primary key is not unique (such as the record already exists), then the record is rejected.
The method works in the same way as the ../record/record-init-method.
## Example
The following example opens a table 18 (Customer) with a RecordRef variable that is named CustomerRecref. The recordref-field-method creates a FieldRef variable that is named MyFieldRef for the field. The Init method initializes the values in the fields by using default values and then uses the recordref-insert--method to insert a new record. The new record is 1120. This is the primary key for the new record.
> NOTE
> In this example, the Init method is called before the primary key is assigned a value. The Init method does not initialize primary key fields. Therefore calling the Init method before or after you assign values to the primary key field does not make any difference.
```al
var
    CustomerRecref: RecordRef;
    MyFieldRef: FieldRef;
    Text000: Label 'The value of the field before initialization is %1.';
    Text001: Label 'The value of the field after you insert the record is %1.';
begin
    CustomerRecref.Open(18);
    MyFieldRef := CustomerRecref.Field(1);
    CustomerRecref.Init;
    Message(‘%1’, MyFieldRef.Value);
    MyFieldRef.Value := '1120';
    CustomerRecref.Insert;
    Message(‘%1’, MyFieldRef.Value);
end;
```
## Related information
recordref-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

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/recordref/recordref-init-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. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/recordref/recordref-init-method/
