GET Function (Record)

Gets a record based on values stored in primary key fields.


[Ok :=] Record.GET([Value] ,...)  


Type: Record

The record in the table.

Type: any

Values in primary key fields. The data type of this parameter must match the data type of the corresponding primary key field. For example, if you enter an integer, the data type of the corresponding primary key field must also be an integer. The value 0 (zero) or an empty string is assigned to unspecified fields.

Property Value/Return Value

Type: Boolean

true if the record was found; otherwise, false.

If you omit this optional return value and if the record cannot be found, then a run-time error occurs. If you include the return value, then you must handle any errors.


This function always uses the primary key for the table. It ignores any filters that are set, except security filters. Security filters are applied or ignored based on the Security Filter Mode. The current key and filters are not changed after you call this function. For more information, see Security Filter Modes.

This function ignores any call to the SETAUTOCALCFIELDS Function (Record). Therefore, a GET call on a record after a SETAUTOCALCFIELDS call does not automatically calculate FlowFields in the record.


You cannot use the GET function to retrieve a record in a table by its primary key value if the primary key field in the table has the data type RecordID. In this case, you can retrieve the record by using the Record.SETRANGE(FieldName, FieldValue) function.


This example requires that you create the following variable and text constants in the C/AL Globals window.

Variable name DataType Subtype
CustomerRec Record Customer
Text constant ConstValue
Text000 The record was found.
Text001 The record could not be found.
// This statement causes a run-time error if customer 1120 cannot be   
// found. To avoid this, use the following construct:  
IF CustomerRec.GET('1120') THEN  

See Also

Record Data Type
FILTERGROUP Function (Record)
GET, FIND, and NEXT Functions