GET USERNAME AND SECURITY ROLES IN DYNAMICS AX 2012
display Notes getUserIdAndRoles()
{
DirPerson DirPerson;
DirPersonUser DirPersonUser;
SecurityUserRole SecurityUserRole;
SecurityRole SecurityRole;
Notes returnNotes;
str value;
;
DirPerson = DirPerson::find(this.Person);
DirPersonUser = DirPersonUser::findWorker(this.RecId);
returnNotes = strFmt("User ID : %1 \n\n
",DirPersonUser.User);
returnNotes = strFmt("%1Security Roles :
\n",returnNotes);
while select * from SecurityUserRole
where SecurityUserRole.User ==
DirPersonUser.User
join SecurityRole
where SecurityRole.RecId ==
SecurityUserRole.SecurityRole
{
if(subStr(SecurityRole.Name,1,1) ==
'@')
{
value =
SysLabel::labelId2String2(SecurityRole.Name, companyinfo::languageId());
returnNotes = strFmt("%1
%2\n",returnNotes,value);
}
else
{
returnNotes = strFmt("%1
%2\n",returnNotes, SecurityRole.Name);
}
}
return returnNotes;
}
No comments:
Post a Comment