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()));
}
}
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()));
}
}
No comments:
Post a Comment