Get Method

Gets a record based on the ID of the record.

Syntax

[Ok := ]  RecordRef.Get(RecordID: RecordId)

Parameters

RecordRef
 Type: RecordRef
An instance of the RecordRef data type.

RecordID
 Type: RecordId
The RecordID that contains the table number and the primary key of the table and is used to identify the record that you want to get.

Return Value

Ok
 Type: Boolean
true if the operation was successful; otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.

Remarks

This method 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 method. .

Example

The following example opens the Customer table with the RecordRef variable, RecRef. The code assigns the first field in the table, which is the No. field, to MyFieldRef variable. The variable is assigned a value of 30000 by using the FIELD Method (RecordRef). The RECORDID Method (RecordRef) retrieves the record ID of the record that has a value of 30000 in the No. field. The GET method then uses the RecID variable then to retrieves the record.

var
    RecRef: RecordRef;
    MyFieldRef: FieldRef;
    RecID: RecordId;
begin     
    RecRef.OPEN(DATABASE::Customer);  
    MyFieldRef := RecRef.FIELD(1);  
    MyFieldRef.VALUE := '30000';  
    if RecRef.FIND('=') then begin  
      RecID := RecRef.RECORDID;  
      RecRef.GET(RecID);  
    end;  
end;

See Also

RecordRef Data Type
Getting Started with AL
Developing Extensions