Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Unanswered

Blob field in Record Link table

(0) ShareShare
ReportReport
Posted on by 82

Hi,

I am generating email notifications when notes are inserted, modified or deleted. In the events 'OnAfterInsertEvent' and 'OnAfterModifyEvent' I can retrieve the text of the note using the following code:


Rec.Note.CreateInStream(InStream, TEXTENCODING::UTF8);
CommentRec := TypeHelper.ReadAsTextWithSeparator(InStream, TypeHelper.LFSeparator);


The problem is that in the 'OnBeforeDeleteEvent' and 'OnAfterDeleteEvent' events the text of the note seems to be already deleted, since the code above returns me an empty string. I have used the event recorder and I don't see any interesting events to which I can subscribe. Any suggestion?

Regards.

  • MiguelRospa Profile Picture
    MiguelRospa 82 on at
    RE: Blob field in Record Link table

    That's what I think, that in the OnBeforeDelete event it should be possible to access the blob field, but it is the only field that seems to have been deleted before the event has been executed.

    Version: Business Central 16.1

    Kind regards.

  • Inge M. Bruvik Profile Picture
    Inge M. Bruvik 993 Super User 2024 Season 1 on at
    RE: Blob field in Record Link table

    Sorry, i did not realize that you worked in an event trigger. I thought you worked with a table trigger.

    In the OnAfterDelete event you should expect the field to be empty. But in the OnBeforeDelete event it should be possible to get hold of the value that is about to be deleted.

    What version are you on ?

  • MiguelRospa Profile Picture
    MiguelRospa 82 on at
    RE: Blob field in Record Link table

    Thank you very much for the answer Inge, but I know how xRec and Rec work. The function header is as follows:

    [EventSubscriber(ObjectType::Table, Database::"Record Link", 'OnAfterDeleteEvent', '', false, false)]
    local procedure OnAfterDeleteEvent(RunTrigger: Boolean; var Rec: Record "Record Link");

    and all fields except the Blob type can be accessed. It seems that before the OnBeforeDeleteEvent is executed this field has already been cleared and unfortunately there doesn't seem to be another event that I can subscribe to.

  • Inge M. Bruvik Profile Picture
    Inge M. Bruvik 993 Super User 2024 Season 1 on at
    RE: Blob field in Record Link table

    In the delete triggers you should use xrec and not rec.

    xrec holdes the value of the record that is about to be deleted. Rec is the current record.

    This is a good video to watch to understand xrec

    www.youtube.com/watch

  • MiguelRospa Profile Picture
    MiguelRospa 82 on at
    RE: Blob field in Record Link table

    Hello, thanks for answering. I have tried to register on the website you indicate but I have not received any email to complete the registration. Could you help me?.

  • Andy Sather Profile Picture
    Andy Sather on at
    RE: Blob field in Record Link table

    Hello  - We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    I will open this up to the community in case they have something to add.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,379 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans