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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Dirty reads on the Audit Trail using SDK

(0) ShareShare
ReportReport
Posted on by 15

Hi folks,

Just wondering if anyone has faced issues trying to retrieve the audit trail using SDK, which seems to be a problem regarding dirty reads. Some audit records are retrieved even for uncommitted transactions which might be roll backed depending on business validations in plugins, etc. Just to give you some background, I have a custom job that replicates the audit trail to another database (it runs at every 2 minutes), and I've been facing issues with mismatching if you compare the databases. The other database has more entries than CRM's database due issue above.

I am using QueryExpression and even setting the NoLock property to false, it is just ignored by the SDK. If you query directly against the CRM database, you can retrieve just commited audit entries, which is what I want to do using SDK. I don't want to change my job to query against the CRM database, as it might move to cloud in the future.

I've noticed that even using the CRM User Interface on the audit summary, the behavior is the same (dirty reads).

Any thoughts would be appreciated,

Thanks.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    David Jennaway Profile Picture
    14,065 on at

    I don't think you can change the CRM behaviour - I expect Microsoft deliberately allow dirty reads to maintain performance when writing to the audit log. One workaround could be to only read audit data that was written more than 2 minutes ago , as any data should either have been committed or rolled back in that time (by default 2 minutes is the longest that CRM will keep a transaction open)

  • Felipe Barboza de Lima Profile Picture
    15 on at

    Hi David,

    Your point of view makes a lot of sense to me.

    Thanks for that!

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans