GETPOSITION Function (Record)

Gets a string that contains the primary key of the current record.


String := Record.GETPOSITION([UseCaptions])  


Type: Record

The record that contains the primary key.

Type: Boolean

Indicates whether a reference to the field caption or the field number should be returned.

The UseCaptions parameter is optional. If it is set to true (default value) or if it is empty, then the returned string contains references to field captions in the table with which the record is associated. If the parameter is set to false, then field numbers are used instead.

Property Value/Return Value

Type: Text or code

The primary key of the current record. The string has the same format as the SourceTable Property on a page.


The following example uses the GETPOSITION function to retrieve the primary key of the current record (MyRecord) from the Customer table. The primary key is stored in the varPrimaryKey variable and displayed in a message box. This example requires that you create the following variables in the C/AL Globals window.

Variable name DataType Subtype
MyRecord Record Customer
varPrimaryKey Text Not applicable
varPrimaryKey := MyRecord.GETPOSITION(TRUE);  

See Also

Record Data Type