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; }
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":
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
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,113 Super User 2024 Season 2
Martin Dráb 229,918 Most Valuable Professional
nmaenpaa 101,156