Retrieving accidently deleted case record from Audit Summary view RRS feed

  • Question

  • In CRM 2011 On-Premise,When I try to run the below code to recover the case record linked to Account. I am getting the error message as "you should specify a parent contact or account". Could anyone please help me in retrieving the record from Audit Summary View.Many thanks in advance.

    Guid auditId = new Guid("B3A46BAF-C0F0-E311-A0C3-6C3BE5B2BB18"); RetrieveAuditDetailsRequest request = new RetrieveAuditDetailsRequest(); request.AuditId = auditId; RetrieveAuditDetailsResponse response = (RetrieveAuditDetailsResponse)service.Execute(request); //create auditDetail variable and assign its value AuditDetail auditDetail = response.AuditDetail; //type cast audtitDetail as AttributeAuditDetail AttributeAuditDetail attributeAuditDetail = auditDetail as AttributeAuditDetail; //create the deletedrecord service.Create(attributeAuditDetail.OldValue);

    Wednesday, June 11, 2014 11:55 AM

All replies

  • The OldValue of an AttributeAuditDetail only contains the value for one attribute. It sounds like you're trying to recreate a whole case record - for this you'll need to create an instance of the case entity, and set each attribute value separately

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Wednesday, June 11, 2014 2:01 PM