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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

How to de-reference Media fields?

(1) ShareShare
ReportReport
Posted on by 171
Hello folk!
This is my first time playing around with Media Type instead of blog and I'm facing a bit of a challenge.
I have two tables - Location Master with a Media Type field storing QR Codes and Sales Header where the QR Code is to be referenced.
When the Location is set on the Sales Header, I can use the Validate trigger to set the /Location QR Code/ field of the Sales Header by assigning the /QR Code/ of the Location record.
However, when the time comes to change the Location Code on the Sales Header and I try to de-reference the /Location QR Code/ of the Sales Header, I end up deleting the QR Code's data from the main /Location/ record itself.
If I use the Import/Export stream methods that creates additional tenant media records which uses up more space than necessary.
I read in the Microsoft docs that as long as the Tenant Media record is being referenced somewhere, it does not get deleted so I was hoping that would work out.
Also, this blog here suggests that when we assign a Media field to another, then both reference the same record in the Tenant Media table.
I want to know how to dereference one of them.
Any direction is highly appreciated!
I have the same question (0)
  • Suggested answer
    Gerardo Rentería García Profile Picture
    25,545 Most Valuable Professional on at
  • RahulBansode Profile Picture
    171 on at
    Hi there!
    My goal is to prevent the deletion of the Tenant Media record and simply de-reference it from one of the records without affecting the other,
    Orphaned Media records are not really relevant here.
  • Suggested answer
    YUN ZHU Profile Picture
    98,026 Super User 2026 Season 1 on at
    Hi, have you tried using Clear method?
    For example,
    Clear(Rec.Picture);
     
    Hope this helps.
    Thanks.
    ZHU
     
  • RahulBansode Profile Picture
    171 on at
    Hi Yun Zhu,
     
    I have tried the clear(Rec.MediaField) function as well however it ends up deleting the media from both the tables i.e. the Tenant Media record itself is deleted.
    I also tried reassigning it to a uninitialized media field (Rec.MediaField = TempRec.MediaField) but that also erased the data from both the tables which is rather unexpected.
  • Suggested answer
    YUN ZHU Profile Picture
    98,026 Super User 2026 Season 1 on at
    If it is MediaSet Data Type, you can try the following mehtod, but Media data type does not. . . .
    MediaSet.Remove(Guid) Method

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,091 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,032 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 946 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans