Skip to main content

Notifications

Announcements

No record found.

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

Can't modify the Sales Cr.Memo Line (table 115) with .al code

(0) ShareShare
ReportReport
Posted on by 65

I think this is the case with the other "posted tables" as well, as I have seen a few discussions on this. This is a system permissions error, when I have the SUPER permission set, and have allocated this specific permission to my user as well. I have also generated an .al file permission set as well, with the error still presenting itself.

Please see the below code I have. I have many variations that I have tried to get the data on the Sales Cr.Memo Line to modify/update (second screenshot is the error):

On the vast majority of tables (when your user has the correct permissions) this is never an error that occurs, but on all "posted" tables this seems to be a common theme. Does anyone have a way that they have found to be able to modify data using the modify() procedure for this table or other tables that present this error when using that procedure? 

Thanks. 

action(Test)
            {
                Caption = 'Test';
                ApplicationArea = All;

                trigger OnAction()
                var
                    SalesCrMemoHeader: Record "Sales Cr.Memo Header";
                    Salescrmemolines: Record "Sales Cr.Memo Line";

                begin
                    Salescrmemolines.Reset();
                    Salescrmemolines.SetRange("Document No.", SalesCrMemoHeader."No.");
                    Salescrmemolines.SetRange(Type, Salescrmemolines.Type::Item);
                    if
                    Salescrmemolines.Findset()
                    then
                        repeat
                            Salescrmemolines."Unit Cost" := Salescrmemolines."Orbus Unit Cost";
                            Salescrmemolines."Unit Cost (LCY)" := Salescrmemolines."Orbus Unit Cost";
                            Salescrmemolines.Modify(); // this is the line where system permission error occurs
                        until
                        Salescrmemolines.Next() = 0;

                end;
            }

Screenshot-2023_2D00_01_2D00_23-171836.png

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    RE: Can't modify the Sales Cr.Memo Line (table 115) with .al code

    Hi, If you want to modify the posted data, you need to add the Permission property.

    More details: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-permissions-property

    For example in codeunit 80 "Sales-Post":

    pastedimage1674517841805v1.png

    But please note that it is very dangerous to directly modify the posted data, and it is not recommended to do this kind of processing in the code.

    Hope this helps.

    Thanks.

    ZHU

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