Wednesday, 8 November 2017

To get the list of Roles assigned to users in AX 2012

we can fetch the required data from Two tables with the help of a small job.
Tables :  SecurityRole & SecurityUserRole



static void SecurityRole(Args _args)
{
  SecurityRole          securityRole;
  SecurityUserRole     securityUserRole;
  
    while select RecId,name from securityRole   
    join securityUserRole   
    where securityRole.RecId == SecurityUserRole.SecurityRole   
    //&& SecurityUserRole.User == curUserId() //for current user roles
    {
      info(strFmt("%1 - %2",SecurityUserRole.User,securityRole.name));
    }
}

No comments:

Post a Comment

8 Common Errors in Dual-write

502 Bad Gateway : when the target application is not ready to handle the incoming request  401 Unauthorized / 403 Forbidden: This error occ...