web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Security Roles - Record Level Privileges Data OData Feed

(0) ShareShare
ReportReport
Posted on by

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!

I have the same question (0)
  • Suggested answer
    Adrian Begovich Profile Picture
    1,032 Moderator on at

    Hi grant.culp,

    You can obtain this information with the Export Security Role tool in the XrmToolBox.

  • Community Member Profile Picture
    on at

    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.

  • Suggested answer
    Adrian Begovich Profile Picture
    1,032 Moderator on at

    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.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

#2
ManoVerse Profile Picture

ManoVerse 55 Super User 2026 Season 1

#3
11manish Profile Picture

11manish 37

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans