How to open AX with a User Role and debug it at the same time in Dynamics #AX2012

Recently came across a scenario where we had to debug a user session that had limited rights to the system, one way of doing that could be for instance walking through a trace of the user session and another would be to debug code while user steps through the process but that would be done only for server side calls. So what if we need to debug client side calls as well, how to go about doing that was the challenge. Since if we assign the user role to an admin and execute the process we also have admin privileges which are higher up the ladder and do not limit access to what that user role has. Not to worry there is a way you can do this by following the steps below:

1. Run Dynamics AX as an administrator
2. Add the role you want to debug to your own user, let the Sys Admin role stay as well.
3. Open a new development Work space.
4. Place breakpoints where you need them.
5. Create below job
static void NonAdmin(Args _args)
{
securityutil::sysadminmode(false);
}
7. Execute the above job
8. Open a new workspace
9. Run the process you wanted to debug.

You should now be able to hit the break point you placed in Microsoft Dynamics AX 2012 Debugger as the User role.

P.s I found this thanks to an old post by a colleague of mine.

 

Leave a comment