Announcements
No record found.
Hi,
My goal is to be able to get the data that shows what Security Roles have what privileges. Specifically, I am looking to get the data of record-level privileges for each security role. I am hoping to pull this data through the API (Odata Feed) so I can display in a Power BI report. I was able to find how users are related to security roles but I can not find out how Security Roles are related to their privileges specifically the record level privileges. Has anyone been able to do this before?
Any help is appreciated thank you!
Hi grant.culp,
You can obtain this information with the Export Security Role tool in the XrmToolBox.
Thank you for your reply! Do you know if this information is available through the API to read in? I want to build something that updates consistently with the changes.
Hi grant,club,
The RetrieveRolePrivilegesRole Function is what you are looking for.
var eachRolePrivileges = []; var roles = Xrm.Utility.getGlobalContext().userSettings.securityRoles; roles.forEach(function(item, i) { eachRolePrivileges[i] = retrieveRolePrivileges(item); }); retrieveRolePrivileges(roleId); function retrieveRolePrivileges(roleId) { var url = Xrm.Page.context.getClientUrl(); var req = new XMLHttpRequest(); req.open( "GET", url "/api/data/v9.1/RetrieveRolePrivilegesRole(RoleId=" roleId ")", false ); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Prefer", 'odata.include-annotations="*"'); req.send(); if (req.readyState === 4) { if (req.status === 200) { var results = JSON.parse(req.response); return results.RolePrivileges; } else { console.log('err'); } } }
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Muhammad Shahzad Sh... 69 Most Valuable Professional
ManoVerse 55 Super User 2026 Season 1
11manish 37