Sample code to close a quote as won using WinQuoteRequest in CRM 2016 (and earlier)

Just sharing a sample code to close quote as won through C#


WinQuoteRequest winQuoteRequest = new WinQuoteRequest();
Entity quoteClose = new Entity("quoteclose");
quoteClose.Attributes["quoteid"] = new EntityReference("quote", new Guid("015816C2-2F10-E611-8112-3863BB353ED0"));
quoteClose.Attributes["subject"] = "Quote Close" + DateTime.Now.ToString();
winQuoteRequest.QuoteClose = quoteClose;
winQuoteRequest.Status = new OptionSetValue(-1);
organizationProxy.Execute(winQuoteRequest);

Hope it helps..

Using Rollup fields with Account Hierarchy in CRM 2015.

We recently had a requirement wherein we had one custom entity Financial Detail associated to Account as many to one relationship.

i.e. One account record can have multiple Financial Details records associated.

We had this field Total (currency) in Financial Detail entity of type currency.

The requirement was to have sum of Total of all related Financial Details records of the Account record plus of any Sub Accounts (child accounts up to n level).

It would have been painful if we had to implement the same using Plugin.

This we can achieve easily using Rollup Field in Account

Below is the definition of the Roll up field named Total Rollup

  • Set Hierarchy as Yes.
  • Select Financial Details as the related entity.
  • Filter based only Active records.
  • In Aggregation specify Sum of Total (currency field in Financial Details record).

 

Hope it helps.