Skip to main content

Notifications

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!

  • Suggested answer
    Adrian Begovich Profile Picture
    1,023 Super User 2025 Season 1 on at
    RE: Security Roles - Record Level Privileges Data OData Feed

    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');
          }
        }
    }

  • Community Member Profile Picture
    on at
    RE: Security Roles - Record Level Privileges Data OData Feed

    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,023 Super User 2025 Season 1 on at
    RE: Security Roles - Record Level Privileges Data OData Feed

    Hi grant.culp,

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

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,017 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,852 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans