Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Error Message: Sorry, the current permissions prevented the action - when test run

(1) ShareShare
ReportReport
Posted on by 104

Hi. After update the BC version to 'current evaluate' I have big problem with my tests. In many situations I get an error related to permissions - for example:

Error Message: Sorry, the current permissions prevented the action. (TableData Locations Management Insert: TestsApp)

This error occurs when test app try to Insert new Locations Management record in Test Codeunit. I have no idea why.

- I run test as user with SUPER permissions

- In effective permissions tabledata 'Locations Management' have all permissions (insert etc) checked

- In properties of test Codeunit I add the line:

    Permissions = tabledata "Locations Management" = RIMD

What more can I do in this situation? I get the same error with some standard objects - like User table.
  • Suggested answer
    yannstlo Profile Picture
    yannstlo 114 on at
    Error Message: Sorry, the current permissions prevented the action - when test run
    I was helping a co-worker with the same issue today and resolved it by adding the following to the top of the Test Codeunit...
    TestPermissions = Disabled;

    I read through this post and tried what ZHU suggested but it did not help.
    Went back to google and found this page which gave me the solution...
    https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-testpermissions-property

    Yann
  • Verified answer
    RoelS Profile Picture
    RoelS 35 on at
    RE: Error Message: Sorry, the current permissions prevented the action - when test run

    Thanks Greex, very helpful!

  • greex Profile Picture
    greex 104 on at
    RE: Error Message: Sorry, the current permissions prevented the action - when test run

    twitter.com/.../1582747210013605888

  • RoelS Profile Picture
    RoelS 35 on at
    RE: Error Message: Sorry, the current permissions prevented the action - when test run

    Hi Greex,

    I'm running into the same problem. Did you find a solution yet?

    Best regards,
    Roel

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 75,942 Super User 2024 Season 2 on at
    RE: Error Message: Sorry, the current permissions prevented the action - when test run

    Hi, if you are using the On-Pre version, this may be a license issue.

    I'm not sure if this is relevant, you can find some details in the MS Yammer link below.

    https://www.yammer.com/dynamicsnavdev/threads/1944546333016064

    pastedimage1665728300688v1.png

    Hope this helps.

    Thanks.

    ZHU

  • greex Profile Picture
    greex 104 on at
    RE: Error Message: Sorry, the current permissions prevented the action - when test run

    In previous version of BC tests work correctly.

  • greex Profile Picture
    greex 104 on at
    RE: Error Message: Sorry, the current permissions prevented the action - when test run

    Thank you for your reply!

    Unfortunatelly - still not working. I assigned permissions in permission set file (using the new command), but I got the same error.

    In 'effective permissions' table I checked that I have permissions to insert into this table.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 75,942 Super User 2024 Season 2 on at
    RE: Error Message: Sorry, the current permissions prevented the action - when test run

    Hi, Do you generate the permission set for the TestApp?

    pastedimage1665705266734v1.png

    PS: al.generatePermissionSetForExtensionObjects is a new command in Business Central 2022 wave 2 (BC21)

    More details: https://yzhums.com/29221/

    Then assign this permisson set to user, and try again.

    A simple example:

    pastedimage1665705482281v2.png

    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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,476 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans