Hi!
I'm making a PostOperation plugin for the Case entity, im trying to retrive all the Active cases owned by the same Account, but the problem is that is not counting correclty, here's the code:
//Data context to retrieve the info
CrmDataContext context = new CrmDataContext(localContext.OrganizationService);
context.MergeOption = MergeOption.NoTracking;
//Early bound entity
Incident targetIncident = ((Entity)localContext.PluginExecutionContext.InputParameters["Target"]).ToEntity<Incident>();
//Count the total of ACTIVE cases of the actual account
var totalCases = (from incident in context.IncidentSet
where incident.CustomerId.Id == targetIncident.CustomerId.Id && incident.StateCode.Value == IncidentState.Active
select incident).ToList();
What i'm doing wrong?
Thanks!
*This post is locked for comments