Media.MediaId() Method

Version: Available or changed with runtime version 1.0.

Gets the unique identifier of a media object on a record.

Syntax

MediaId :=   Media.MediaId()

Note

This method can be invoked using property access syntax.

Parameters

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

Return Value

MediaId
 Type: Guid
The GUID of the Media object in the database.

Remarks

When a media is imported on the Media data type field of table record, the media is given a GUID and stored in the system table 2000000184 Tenant Media of the application database. The GUID is then included in the Media data type field as a reference to the media in the database.

Example

This example uses the MediaId method to get the GUID of the media object that is used on item number 1 in the a the table named My Items.

The example assumes that the My Items table already exists and has a Media data type field named Image.

 var
    myItemRec: Record "My Items";
    imageID: GUID;
    Text000: Label 'Item %1 has a media object with the following ID: %2';
begin
    myItemRec.Get('1');  
    mediaGuid := myItemRec.Image.MediaId;  
    Message(Text000, myItemRec."No.", imageID);  
end;

Media Data Type
Get Started with AL
Developing Extensions