CRM 2011 Using FetchXml to aggregate

string sumFetch = @”

“;

//Pass Job Guid to the Query
string formatXml = string.Format(sumFetch, workInstruction.an_Job.Id.ToString());
EntityCollection sumCol = service.RetrieveMultiple(new FetchExpression(formatXml));

var Job = (Incident)service.Retrieve(Incident.EntityLogicalName,workInstruction.an_Job.Id, new ColumnSet(“an_totalinminutes”,”an_totalinhours”));
foreach (var sum in sumCol.Entities)
{
Job.an_TotalinMinutes = Convert.ToDecimal(((AliasedValue)sum[“an_totaltimemin_sum”]).Value.ToString());
Job.an_TotalinHours = Convert.ToDecimal(((AliasedValue)sum[“an_totalinhrs_sum”]).Value.ToString());
Job.an_EstimatenumberofDays = Convert.ToDecimal(((AliasedValue)sum[“an_totalinhrs_sum”]).Value.ToString()) / 8;

service.Update(Job);
}

Advertisements

3 Responses to CRM 2011 Using FetchXml to aggregate

  1. Eric Thompson says:

    This feature requires Microsoft Dynamics CRM 4.0 Update Rollup 2, that can be found at http://www.microsoft.com/downloads/details.aspx?familyid=aa671769-61e9-45c4-919f-c88199aa4241&displaylang=en&tm.

  2. Hi! Do you know if they make any plugins to safeguard against hackers?

    I’m kinda paranoid about losing everything I’ve worked hard on. Any suggestions?

    • Thabiso says:

      Not at the moment.
      If you can give me an example of what you want to safeguard, maybe I will be able to point you in the right direction. Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Workflow Elements by Aiden Kaskela

Business Solutions (CRM) MVP, Contractor, Evangelist

MSDYNAMICSBLOG BY DEEPESH

Real Experiences from Analyzing, Architecting, developing and working with Dynamics CRM, Dynamics 365 and sometimes .net

Mark Margolis's Blog

It's about Software, CRM, Product Development and sometimes Food.

GT // CRM

Gareth Tucker on Microsoft Dynamics CRM

Donna Edwards

Sharing my Journey with Dynamics 365

The WordPress.com Blog

The latest news on WordPress.com and the WordPress community.

%d bloggers like this: