Skip to main content

Notifications

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

Permission set to RIMD, but Item Modify Error

Posted on by 130

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;
}

pastedimage1674785673528v2.png

  • SammySevens Profile Picture
    SammySevens 130 on at
    RE: Permission set to RIMD, but Item Modify Error

    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

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,333 Super User 2024 Season 2 on at
    RE: Permission set to RIMD, but Item Modify Error

    Hi, I think this is standard error.

    For example,

    pastedimage1675044498022v1.png

    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?

    pastedimage1675044611168v2.png

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Permission set to RIMD, but Item Modify Error

    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?

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans