web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Delete mediaset and its' tenant media

(0) ShareShare
ReportReport
Posted on by 50

Hi,

I want to remove a picture in item via functions and i'm writing this.

The problem is, even if the picture deleted from the mediaset field, it wasn't deleted in tenant media. What's the connection between this and the tenant media ?

    procedure DeleteItemPicture(parItemNo: Code[20]ReturnVal: Text
    var
        Item: Record item;
        B64cu: Codeunit "Base64 Convert";
        TM: Record "Tenant Media";
        MediaGUID: Guid;
    begin
        item.get(parItemNo);
        if item.picture.Remove(item.picture.Item(1)) then begin
            item.modify;
            exit('delete done');
        end else
            exit('delete can not be done');
    end;
I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    You can retrieve the Tenant Media record connected to the picture field by doing:

    TenantMedia.Get(Item.Picture.Item(index)) and then delete it.

  • Zdenek Zert Profile Picture
    10 on at

    Be careful. if you use item.picture.Remove... records in Tenant Media and Tenant Media Thumbnails tables will remain - and you will lose link to original item, so you won't be able to distinguish, what tenant media record belongs to which record in database.

    The only completely working way seems to be:

    CLEAR(Item.Picture);
    Item.MODIFY()

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,010

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,270 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,085 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans