I looked around the forum, and couldn't come up with a solution, so:
I'm very new to CRM, and I'm having trouble finding specific information on how to get certain things to work. In this case, I have a parent view which contains a column containing a rollup of values from children. In the Retrieve version, everything works fine, and the value is an accurate sum of the child values. I'm just not sure how to get it to also show in the RetrieveMulitple version. Here's what I have so far.
Retrieve version:
//Rollup on Retrieve if (context.OutputParameters.Contains("BusinessEntity") && context.MessageName.Equals("Retrieve", StringComparison.InvariantCultureIgnoreCase)) { Entity parent = context.OutputParameters["BusinessEntity"] as Entity; using (VetUnitedXrm.XrmContext xrm = new VetUnitedXrm.XrmContext(serviceFactory.CreateOrganizationService(null))) { var total = (from c in xrm.new_childSet where c.new_ParentId != null && c.new_ParentId.Id == parent.Id&& c.new_Amount != null select c.new_Amount).ToList().Sum(); if (parent.Contains("new_childrollup")) { parent["new_childrollup"] = total; } else { parent.Attributes.Add(new KeyValuePair<string, object>("new_childrollup", total)); } } }
How do I get this to work in the RetrieveMulitple version?
Thanks in advance for any help you can offer.