Skip to main content

Notifications

Announcements

No record found.

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

  • Suggested answer
    Nishant Rana Profile Picture
    11,323 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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans