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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Get Data From Audit History

(0) ShareShare
ReportReport
Posted on by 247

We have a status field on the form and also Auditing is turned on for the forms. I need to create a report, which displays Status of all the records and last time the value was changed for the status field. Can someone please guide me how to query the Audit History tables. 

Thank you

SJ

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Nishant Rana Profile Picture
    11,325 Microsoft Employee on at
  • Verified answer
    SamCRM1 Profile Picture
    247 on at
    RE: Get Data From Audit History

    Since I needed the history in the CSV file, I built the console application and got the result using following code:

                   CrmServiceClient crmConn = new CrmServiceClient(ConfigurationManager.ConnectionStrings["CRM"].ConnectionString);

                   IOrganizationService crmService = crmConn.OrganizationServiceProxy;

                   RetrieveAttributeChangeHistoryRequest request = new RetrieveAttributeChangeHistoryRequest();

                   var response = (RetrieveAttributeChangeHistoryResponse)crmService.Execute(request);

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Get Data From Audit History

    Hello,

    You can use this fetch to get records from audit entity or use XRMtoolBox for this

    <fetch top="50" >

     <entity name="audit" >

       <attribute name="useridname" />

       <attribute name="attributemask" />

       <attribute name="operation" />

       <attribute name="objecttypecodename" />

       <attribute name="objectid" />

       <attribute name="operationname" />

       <attribute name="transactionid" />

       <attribute name="useradditionalinfo" />

       <attribute name="regardingobjectidname" />

       <attribute name="auditid" />

       <attribute name="createdon" />

       <attribute name="userid" />

       <attribute name="callinguseridname" />

       <attribute name="regardingobjectid" />

       <attribute name="objecttypecode" />

       <attribute name="action" />

       <attribute name="actionname" />

       <attribute name="objectidname" />

       <attribute name="callinguserid" />

     </entity>

    </fetch>

    You can filter on which entity you want to use.

    Hope you can understand what I mean!

  • Suggested answer
    Preeti Sharma Profile Picture
    2,678 on at
    RE: Get Data From Audit History

    Hi,

    You can't query audit table if you are using CRM online as crm does not contain any audit entity.

    If you are using on premise then you can query "AuditBase" table from SQL and get data as you required.

    Hope this helps:)

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at
    RE: Get Data From Audit History

    Hi,

    it's not easy to write report on audit data, but you can start from here: marcuscrast.wordpress.com/.../dynamics-crm-2011-audit-report-in-ssrs

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans