I have a requirement to get current logged in user details with all roles he has been assigned, based on role, I need to show and hide some fields, How to achieve this in model driven app.
Please let me know, is this achievable or not, if yes then how can we achieve this.
Thank you.
Hello @durugappab
Hope you are doing good,
You can use Xrm.Utility.getGlobalContext().userSettings to get Logged in User and their Security Roles
Xrm.Utility.getGlobalContext().userSettings.roles
Above mentioned Code will provide you user Security Roles
This Link will help you to show or Hide Button based on Security Roles
https://ajitpatra.com/2020/09/11/d365-ce-get-logged-in-users-security-roles-using-javascript/
Please mark as Answer if it is helpful and provide Kudos
Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Follow me on Twitter : @rampprakashd
Blog : https://microsoftcrmtechie.blogspot.com
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2