Debugging security errors

Every so often, there is a security-related issue that pops up where the user can see the menu item, but when they launch it they get a security-related error.

A rather convenient way to troubleshoot that sort of thing is by temporarily turning SysAdmin off.*

First, assign the roles you’d like to troubleshoot to yourself.

From the development workspace, execute**:



And then launch a regular workspace. Now you should only see the menu items available to the roles assigned to you.

The beauty of this approach is that you can still catch breakpoints in the debugger to investigate what’s going on.

When you’re done, re-execute the above line to restore Admin mode. If you log out without restoring admin (or if the client crashes), you’ll automatically be back to admin the next time you log into Dynamics AX. (…or will you? dun-dun-dunnn)

*A fun little tidbit I learned from a co-worker here at Sikich just the other day when I encountered such an error.

**It’s usually better to not execute random code from the internet. All code on this blog is provided for educational purposes and if you mess things up, you should have done it in a test environment, so don’t come crying to me. (The code’s good though. For reals, you can trust me because I’m on the internet.)