The curious case of the MediaSet field type in AL

Have you ever wondered why there are two different media field types in AL, but only one UI? I have, and in this video, I’m looking into it:

https://youtu.be/xpTl91SZGK4

In this video, Erik explores the differences between the Media and MediaSet field types in AL for Business Central, examines how they’re actually used in the base application, and raises an interesting question: is the MediaSet field type actually useful in practice?

A Brief History: From Blob to Media Fields

Back in NAV 2017, two new field types were introduced: Media and MediaSet. Before that, developers relied on Blob fields to store binary content like images. The new field types promised a cleaner, more purpose-built approach to handling media:

  • Media – holds a single media item (e.g., one image)
  • MediaSet – holds a collection of media items (e.g., multiple images)

On paper, this distinction makes sense. But as Erik demonstrates, the reality of how these types are used in the base application tells a different story.

Same User Experience, Different Field Types

From an end-user perspective, the picture functionality on a Customer Card and an Item Card looks identical. You can import, export, and delete images. When you import a new image, it replaces the existing one. The behavior is the same in both places.

But under the hood, the implementation is quite different:

  • The Customer table uses a field called Image, which is of type Media
  • The Item table uses a field called Picture, which is of type MediaSet

Two different field types, used for the exact same purpose.

Exploring the IntelliSense Differences

Erik demonstrates the difference in available methods by writing a quick page extension and using IntelliSense to explore what each field type offers:

pageextension 50123 Ext extends "Item Card"
{
    trigger OnOpenPage();
    var
        Customer: Record Customer;
    begin
        //Customer.Image.
        Rec.Picture.
    end;
}

When you type Customer.Image. (a Media field), you get methods appropriate for a single media item. But when you type Rec.Picture. (a MediaSet field), you get additional methods like Insert, Count, and Remove — methods designed for managing a set of media items.

The MediaSet type exposes collection-like operations because it’s designed to hold multiple images. Yet in the base application’s Item Picture page, the import logic always clears whatever was there before and inserts a single image — effectively treating the set as if it only ever contains one item.

The Import Logic Always Clears First

Looking at the base app’s import code for the Item Picture page (page 346), the import action always clears the existing media set before inserting the new image. The Customer Picture page does something similar but with a Media field. The result is identical behavior: one image at a time, regardless of the underlying field type.

So while MediaSet could hold multiple images, the standard Business Central implementation never takes advantage of that capability.

Is There a Good Case for MediaSet?

Erik raises an important practical question: if you actually wanted to store multiple images for a record — say, seven images for a product — you’d almost certainly need more than just a MediaSet field. You’d want:

  • A way to designate which image is the “hero” image
  • Alt text for accessibility
  • Other metadata and attributes per image

In that scenario, you’d likely create a separate table to index and manage the images with their associated metadata. At that point, you could just use individual Media fields on each record in that child table, making the MediaSet type unnecessary.

Real-World Usage

Erik shares his own experience after searching through years of AL code he’s written: the only places he’s ever used the MediaSet type are in applications that need to support all field types generically — tools like BCAL Toolbox or data import/export utilities. He has never created a MediaSet field on a custom table for actual business functionality. He’s created plenty of Media fields, and even more Blob fields, but never a MediaSet for a real-world use case.

Conclusion

The MediaSet field type is an interesting concept — a field that can natively hold multiple media items. But in practice, even Microsoft’s own base application uses it in a way that’s functionally identical to a single Media field. If you truly need multiple images per record, you’ll almost certainly want a supporting table with metadata, which makes individual Media fields the more practical choice. The question remains open: are you using MediaSet in your extensions, and if so, for what? It may well be a field type that’s more of a curiosity than a necessity in real-world AL development.