List of users for a security role | D365FO
Introduction:
In this blog, we will see how we can get list of users who has assigned a specific security role
Solution:
UserInfo userInfo;
SecurityRole securityRole;
SecurityUserRole securityUserRole;
while select networkAlias from userInfo
where userInfo.networkAlias
exists join securityUserRole
where securityUserRole.User == userInfo.id
exists join securityRole
where securityRole.RecId == securityUserRole.SecurityRole
&& securityRole.Name == 'Sales manager(NameOfTheSecurityRole)'
{
info(userInfo.networkAlias);
}
Thanks for reading !!!
Related posts:
How to add an Entity and fields in Global Search On Dynamics 365 CRM
How to create a SharePoint site and enable Server-Based SharePoint Integration for Document Manageme...
Posting Restriction in Business Central for different users for Purchase and Sales documents
Quality Management Process in Dynamics 365 Supply Chain Management - Part 2