Skip to main content

Notifications

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;
  • Zdenek Zert Profile Picture
    10 on at
    RE: Delete mediaset and its' tenant media

    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()

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at
    RE: Delete mediaset and its' tenant media

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

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

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 858

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 569

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans