Showing posts with label Get User Roles Associated with current user. Show all posts
Showing posts with label Get User Roles Associated with current user. Show all posts

Monday, October 23

AX 2012 - Get User Roles Associated with current user in X++ code

Following line of code fetch all roles associated with current login user in microsoft dynamics ax 2012.



static void Getuserroles(Args _args)
{
    SecurityRole role;
    SecurityUserRole userRole;
    UserInfo userInfo;
    ;
    while select role
        exists join userRole
            where role.RecId == userRole.SecurityRole &&
                       userRole.User == curUserId()
    {
        info(strFmt(“%1 – %2”, role.Name,curUserId()));
    }
}

Popular Posts