Hi, if we would like to display the user list with its role, we can use a kind of the following code. It isn't quite a good code as we should join all tables in the while select statement, however I got the display with '@sys..' and not found the solution yet, so I change a bit back to basic by adding one more select in it.
static void getUserWithRole(Args _args)
{
UserInfo userInfo;
SecurityUserRole securityUserRole;
SecurityRole securityRole;
int i=0;
;
while
select userInfo
join securityUserRole
where securityUserRole.User == userInfo.Id
{
i++;
if (i >= 5)
break;
info(userInfo.Id);
securityRole = null;
select securityRole
where securityRole.RecId == securityUserRole.SecurityRole;
if (securityRole)
{
info(securityRole.AotName);
info(securityRole.Name);
info(securityRole.Description);
}
}
}
The result if we write it in csv format, will looks like below. Until the next post!
No comments:
Post a Comment