Hi,
I'm using LINQ to get list of case records using the service context from the generated XRM , when i try to resolve the first case in the list it works fine, but when i try to resolve a different case in the same list it doesn't work , an exception occurs : "The context is not currently tracking the 'incident' entity" . What might be the problem ? it feels like this is a non sense issue.
This works :
svcContext serviceContext = new svcContext(organizationService);
Incident preImageCaseEntity = context.PreEntityImages["PreBusinessEntity"].ToEntity<Incident>();
List<Incident> cases = GetChangeEmailCases(organizationService, preImageCaseEntity, serviceContext);
if (cases.Any())
{
tracingService.Trace(cases.Count.ToString());
Incident lastChangeEmailCase = cases.First();
serviceContext.UpdateObject(lastChangeEmailCase);
serviceContext.SaveChanges();
}
but this doesn't work:
svcContext serviceContext = new svcContext(organizationService);
Incident preImageCaseEntity = context.PreEntityImages["PreBusinessEntity"].ToEntity<Incident>();
List<Incident> cases = GetChangeEmailCases(organizationService, preImageCaseEntity, serviceContext);
if (cases.Any())
{
tracingService.Trace(cases.Count.ToString());
Incident lastChangeEmailCase = cases[1];
serviceContext.UpdateObject(lastChangeEmailCase);
serviceContext.SaveChanges();
}