Dec 9, 2015

Toggling administrative privileges in AX 2012 R3 through code

static void ToggleAdminMode(Args _args)
{
    ;   
    SecurityUtil::sysAdminMode(!SecurityUtil::sysAdminMode());
    info(strFmt('Admin mode: %1', SecurityUtil::sysAdminMode()));
}

Note :- Once you restart the AX client, your privileges will be restored to normal.