Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

How to disable notes?

(0) ShareShare
ReportReport
Posted on by 543

Hi experts,

In my Business Central cloud app, I have made an extension where my new table has notes attached to it using a factbox like this on the page:

area(factboxes)

{
    systempart(Notes; Notes)
    {
        ApplicationArea = Notes;
        Visible = true;
    }
}
It works fine, but I don't want the user to change the notes that are attached to a specific table number.
I cannot make a table extension for the table "Record Link" and I cannot see which pages, I must extend. The notes must not be altered and must not be deleted. But it must be possible to press it and read the full text in view-only-mode.
I hope you can help me.
  • Morten Steengaard Profile Picture
    Morten Steengaard 543 on at
    RE: How to disable notes?

    Hi Deekshitha Reddy,

    It might work, but I'll use the solution, I have written above.

    Best regards,

    Morten

  • Suggested answer
    Deekshitha Reddy Profile Picture
    Deekshitha Reddy 219 on at
    RE: How to disable notes?

    Please try AccessByPermission property

    learn.microsoft.com/.../devenv-accessbypermission-property

    Hope this Helps.

    Please let me know

  • Suggested answer
    Morten Steengaard Profile Picture
    Morten Steengaard 543 on at
    RE: How to disable notes?

    Hi Rahul,

    Thank you for your reply.

    It might work, but before I tried it, I found out that I can solve the problem by making these event subscriptions:

       [EventSubscriber(ObjectType::Table, Database::"Record Link", 'OnBeforeModifyEvent', '', false, false)]

       local procedure OnBeforeModifyEvent(var Rec: Record "Record Link"; var xRec: Record "Record Link"; RunTrigger: Boolean)

       begin

           if Rec."Record ID".TableNo() = Database::"my table" then begin

               Message('Modify is not allowed...');

               Rec.Note := xRec.Note;  // undo the change

           end;

       end;

       [EventSubscriber(ObjectType::Table, Database::"Record Link", 'OnBeforeInsertEvent', '', false, false)]

       local procedure OnBeforeInsertEvent(var Rec: Record "Record Link"; RunTrigger: Boolean)

       begin

           if Rec."Record ID".TableNo() = Database::"my table" then begin

               Message('New note/link is not allowed...');

           end;

       end;

       [EventSubscriber(ObjectType::Table, Database::"Record Link", 'OnBeforeDeleteEvent', '', false, false)]

       local procedure OnBeforeDeleteEvent(var Rec: Record "Record Link"; RunTrigger: Boolean)

       begin

           if Rec."Record ID".TableNo() = Database::"my table" then begin

               Message('Delete is not allowed...');

               Error('Delete is not allowed...');     // This error message is never shown, but it prevents the record from being deleted

           end;

       end;

    Once again, thank you for your time.

    Best regards,

    Morten

  • Suggested answer
    NAV_with_Narang Profile Picture
    NAV_with_Narang 2,236 Super User 2024 Season 1 on at
    RE: How to disable notes?

    Please check if you can do it by assigning the users specific permission sets

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,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans