Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Answered

Retrieving OldRolePrivileges and NewRolePrivileges

Posted on by

Hi All

I am trying to do some analysis on the audit table using Power BI.

I am able to make various web api calls and functions like RetrieveRecordChangeHistory, and have successfully worked on the field changes (stored as column number in attributemask column of the audit table).

However, I am stuck with the role and privilege changes. These are stored as GUID in the attributemask column.

Which web api and function calls can I make to retrieve the RolePrivilegeAuditDetail in order to retrieve the OldRolePrivileges and NewRolePrivileges, as described on https://docs.microsoft.com/en-us/dynamics365/customer-engagement/web-api/roleprivilegeauditdetail?view=dynamics-ce-odata-9 ?

Any help is appreciated.

I am using v9.2

Thanks!

  • meelamri Profile Picture
    meelamri 13,198 User Group Leader on at
    RE: Retrieving OldRolePrivileges and NewRolePrivileges

    You are welcome ! Have a good weekend

  • Josephkm_lim Profile Picture
    Josephkm_lim on at
    RE: Retrieving OldRolePrivileges and NewRolePrivileges

    Hi Medhi

    This is amazing discovery. Thank you for your kind advice. Have a great weekend!

    --

    Yours

  • Suggested answer
    meelamri Profile Picture
    meelamri 13,198 User Group Leader on at
    RE: Retrieving OldRolePrivileges and NewRolePrivileges

    I've replayed the same scenario in two other instances:

    it works for the following versions:

    • 2020 release wave 2 enabled/ Server version: 9.2.20123.00153/ Client version: 1.4.2135-2012.3
    • 2021 release wave 1 enabled/Server version: 9.2.20123.00153/Client version: 1.4.2135-2012.3

    it doesn't work for the next version (same error as yours)

    • 2020 release wave 2 enabled/Server version: 9.2.21012.00146/Client version: 1.4.2134-2101.2

    I recommend opening a support ticket. Looks like the implementation is not completed for some version. 

  • meelamri Profile Picture
    meelamri 13,198 User Group Leader on at
    RE: Retrieving OldRolePrivileges and NewRolePrivileges

    Hi Josephkm,

    I will investigate into other environments and keep you informed.

  • Josephkm_lim Profile Picture
    Josephkm_lim on at
    RE: Retrieving OldRolePrivileges and NewRolePrivileges

    Hi Medhi

    Many thanks for your advice. It's great and useful!

    However, I encountered an error when I execute:

    https://xxxx.crm.dynamics.com/api/data/v9.2/audits(auditid GUID)/Microsoft.Dynamics.CRM.RetrieveAuditDetails()

    "Object reference not set to an instance of an object."

    pastedimage1613088533065v1.png

    I don't understand what could have caused it since I have the audit record when I execute:

    https://xxxx.crm.dynamics.com/api/data/v9.2/audits(auditid GUID)

    pastedimage1613089338122v2.png

    And I can see the data via the Audit Summary View:

    pastedimage1613089996082v2.png

    Would you have any experience regarding this too?

    Thanks in advance!

  • Verified answer
    meelamri Profile Picture
    meelamri 13,198 User Group Leader on at
    RE: Retrieving OldRolePrivileges and NewRolePrivileges

    Hi Josephkm, 

    I tried to do the same thing on my test environment, I got the following result. 

    In order to have RolePrivilegeAuditDetail you will need to execute the Microsoft.Dynamics.CRM.RetrieveAuditDetails() function on an audit with the event "Replace Privileges In Role".

    Example: 

    pastedimage1613040695003v1.png

    The audit record related to this update: 

    https://xxxx.crm.dynamics.com/api/data/v9.1/audits?$filter=action eq 59 and Microsoft.Dynamics.CRM.Today(PropertyName='createdon')

    pastedimage1613041290989v2.png

    Then when you perform your function Microsoft.Dynamics.CRM.RetrieveAuditDetails(): 

    https://xxxx.crm.dynamics.com/api/data/v9.2/audits(e5e448e9-566c-eb11-9889-281878f0b22c)/Microsoft.Dynamics.CRM.RetrieveAuditDetails()

    pastedimage1613041564513v3.png

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,552 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,552 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans