Hi BC Community,
My code is below , but when I run it to update the item cost, I get prompted with permissions error for item.modify.
Appreciate any guidance....this should work shouldn't it?
codeunit 60001 c60001ResetDirectUnitCost { Permissions = tabledata Item = RIMD, tabledata "Item Amount" = RIMD; //Permissions = tabledata "Purchase Line" = m; [EventSubscriber(ObjectType::Table, Database::"Purchase Line", 'OnAfterUpdateDirectUnitCost', '', false, false)] local procedure MyProcedure(var PurchLine: Record "Purchase Line") var item: Record item; begin if PurchLine."Document Type" = PurchLine."Document Type"::Quote then if PurchLine.Type = PurchLine.Type::Item then begin Item.Get(PurchLine."No."); if Item.Type = Item.Type::"Non-Inventory" then begin item."Last Direct Cost" := 0; PurchLine.Validate("Direct Unit Cost", 0); PurchLine.Validate("Tax Area Code", 'CA'); PurchLine.Validate("Tax Group Code", 'TAXABLE'); Item.Modify(); end; end; end; }
Hi Zhu,
Thank you for the feedback. I am sure it is a permission issue as when I set Item_Modify = YES for the user - the user is able to proceed.
I will investigate this further. Thank you
Hi, I think this is standard error.
For example,
So it's still a permissions issue.
is it possible that the currently executing user does not have permission? Please try using Super User.
Or have you generated permissions file for your Extension, and assign it to the user?
Hope this helps.
Thanks.
ZHU
Have you tried to debug this? The error message you are getting does not look like a standard error message. Maybe you have some other extensions installed that prevents you from updating the items?
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,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156