AddLink Method

Adds a link to a record in a table.


[ID := ]  RecordRef.AddLink(URL: String [, Description: String])


 Type: RecordRef
An instance of the RecordRef data type.

 Type: String
The link that you want to add to the record.
 Type: String
Optional description of the link.

Return Value

 Type: Integer
The ID of the URL that you want to add to the record. Every time that you add a link to a page or a table, an entry is created in the Record Link system table. Each entry is given an ID.


The URL can be a link to a Web site, a file stored on the local or on a remote computer, or a link to a Dynamics 365 page. You can then view the link in the Links FactBox on pages that display the record.


The following example adds a link to a record in the Customer table. The code starts by opening table 18 (Customer) as a RecordRef variable that is named CustomerRecref. The FIELD Method (RecordRef) creates a FieldRef variable that is named MyFieldRef for the first field (No.). Next, MyFieldRef.VALUE is set to record 01121212. The FIND Method (RecordRef) method searches the records for record no. 01121212. If the record is found, then the ADDLINK method adds a link to the record. The link is assigned a link ID, which is stored in the LinkID variable. The link ID is displayed in a message box. You can view the link you added in the Links FactBox on the Customer List or Customer Card pages.

    CustomerNum: Code;
    varLink: Text;
    CustomerRecref: RecordRef;
    MyFieldRef: FieldRef;
    LinkID: Integer;
    Text000: TextConst ENU='The link with ID %1 has been added.';
    Text001: TextConst ENU='The customer cannot be found.';
    CustomerNum := '01121212';  
    MyFieldRef := CustomerRecref.FIELD(1);  
    MyFieldRef.VALUE := CustomerNum;  
    if CustomerRecref.FIND('=') then begin  
      LinkID := CustomerRecref.ADDLINK(varLink);  
      MESSAGE(Text000, LinkID);  
    end else

See Also

RecordRef Data Type
Getting Started with AL
Developing Extensions