Skip to main content

Notifications

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

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

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 72,941 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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,918 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans