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
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.
This example requires that you create the following variable and text constants in the C/AL Globals window.
The record was found.
The record could not be found.
CustomerRec.GET('1120'); // 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 MESSAGE(Text000) ELSE MESSAGE(Text001);