web
You’re offline. This is a read only version of the page.
close
Skip to main content
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
    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.

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

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 3,808

#2
Sumit Singh Profile Picture

Sumit Singh 2,554

#3
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 2,140

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans