Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2020 release wave 1 Discover the latest updates and new features to Dynamics 365 planned through September 2020
Release overview guides and videos Release Plan | Preview 2020 Release Wave 1 Timeline
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
I am trying to fetch the audit history of a user from CRM. My code is shown below. However at run time i get an exception "audit With Id = c011f583-8741-e211-bce3-78e7d1622fbb Does Not Exist".
Am I missing something?. Please suggest.
Entity entUser = (from name in context.CreateQuery(Constant.SystemUser.EntityLogicalName)
where name.GetAttributeValue<string>(Constant.SystemUser.FullName) == "Sample"
var auditDetailsRequest = new RetrieveAuditDetailsRequest
AuditId = entUser.Id
using (OrganizationServiceProxy organizationProxy = CRMHelper.GetServiceProxy())
var auditDetailsResponse = organizationProxy.Execute(auditDetailsRequest);
It because you're trying to use id of your user, but AuditId parameter - the ID of the Audit record to retrieve
If you want to get history of changes use RetrieveRecordChangeHistoryRequest (https://msdn.microsoft.com/en-us/library/gg309735.aspx)
if you want to retrieve audit details based on the audit id then you can use RetrieveAuditDetailsRequest.
but here you are trying to retrieve audit details based on user id then you need to use RetrieveRecordChangeHistoryRequest
RetrieveRecordChangeHistoryRequest changeRequest = new RetrieveRecordChangeHistoryRequest(); changeRequest.Target = new EntityReference("systemuser", entUser.Id);we also have RetrieveAttributeChangeHistoryRequest SDK request to retrieve audit details for a specific attribute
var attributeChangeHistoryRequest = new RetrieveAttributeChangeHistoryRequest
Target = new EntityReference(
"incident", new Guid("D22F869B-F79C-E611-80F0-3863BB35EF70")),
AttributeLogicalName = "statuscode"
Business Applications communities