The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.

CURRENTKEY Method (Record)

Gets the current key of a database table.


CurrentKey := Record.CURRENTKEY  


Type: Record

A record that refers to the table for which you want to find the key that is currently in use.

Property Value/Return Value

Type: Text or code

The name of the current key of Record.


The following example returns the current key that is used in the Customer table and displays it in a message box. The MyRecord record is from the Customer table. This example requires that you create the following global variables and text constant.

Variable name DataType Subtype
MyRecord Record Customer
CurrentKey Text Not applicable
Text constant name ConstValue
Text000 The current key is: %1
CurrentKey := MyRecord.CURRENTKEY;  
MESSAGE(Text000, CurrentKey);  

See Also

Record Data Type