Returns a RecordRef for the current record referred to by the key.

RecordRef := KeyRef.RECORD

Parameters

KeyRef

Type: KeyRef

The keyref that refers to the key that is currently selected.

Property Value/Return Value

Type: RecordRef

The RecordRef of the record that is currently selected referenced by the key. If a key is not selected, an error is returned.

Example

The table with ID 18 (the Customer table) is open with a reference. The KeyRef Data Type for the record is retrieved by using the KEYINDEX Function (RecordRef). The function retrieves the key that has an index of 1 in the record and stores the value in the varKeyRef variable. The varKeyRef variable is then used to return the RecordRef Data Type. This example requires that you create the following variables in the C/AL Globals window.

Variable name DataType

RecRef

RecordRef

varKeyRef

KeyRef

 Copy Code
RecRef.OPEN(18);
varKeyRef := RecRef.KEYINDEX(1);
RecRef := varKeyRef.RECORD;

See Also