Skip to main content

Notifications

Announcements

No record found.

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
    Zdenek Zert 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
    Stefano Demiliani 37,162 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,472 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,560 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans