Dynamics 365 Developer Toolkit – The extension is already installed to all applicable products.

We were getting the below error for projects inside our Dynamics 365 Developer toolkit solution template.

Trying to run the setup brought the following message

The fix was to go to Tools à Extensions and Updates and enable the extension.

Fixed à

Hope it helps..

LINQ: GroupBy, Sum and EntityCollection in CRM

Just sharing a sample code that could be used for group by and sum operation on EntityCollection.

Suppose below is the output that we want

We can use the below code for that.

// select categoryid, final forecast, final awards from SubCategory Entity
// category id is lookup in SubCategory Entity

EntityCollection result = orgProxy.RetrieveMultiple(new FetchExpression(fetch));

var details = from r in result.Entities.AsEnumerable()
group r by new
groupByCategoryID = ((EntityReference)r.Attributes["categoryId"]).Id.ToString()
into g
select new
sumFinalForecast = g.Sum(x => Convert.ToInt32(x.Attributes["finalforecast"])),
sumFinalAwards = g.Sum(x => Convert.ToInt32(x.Attributes["finalawards"])),
categoryId = g.Key.groupByCategoryID

// update the parent record
foreach(var detail in details)
Entity entityUpdate = new Entity("category");
entityUpdate.Id = new Guid(detail.categoryId);
entityUpdate.Attributes["totalfinalforecast"] = detail.sumFinalForecast;
entityUpdate.Attributes["totalfinalawards"] = detail.sumFinalAwards;

Hope it helps..