title: CRM 2013 Updating the Quote Product section
body: <p>Has anyone tried to create a plugin that updates the record's values in the Quote Product form? I created one, because I need a custom formula that calculates the Extended Amount field, but there are automatic calculations in the CRM that fill these fields. This doesn't allow me to update the formula of calculation at all. </p>
  
  <p>What my plugin do, is:</p>
  
  <ol>
  <li>Gets the values from the fields Price per unit, Quantity and Discount % (which is a custom field);  </li>
  <li>Calculates the value that I need;</li>
  <li>Sets it at the extended amount field.</li>
  </ol>
  
  <p>But, none of this works because I get a "Business Process Error"; 
  Basically this error tells me that I can't use the record's guid to access it.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>protected void ExecutePostQuoteProductUpdate(LocalPluginContext localContext)
      {
          if (localContext == null)
          {
              throw new ArgumentNullException("localContext");
          }
  
          IPluginExecutionContext context = localContext.PluginExecutionContext;
          IOrganizationService service = localContext.OrganizationService;
  
          Guid quoteProductID = (Guid)((Entity)context.InputParameters["Target"]).Id;
          ColumnSet set = new ColumnSet();
          set.AllColumns = true;
  
          var quote = service.Retrieve("quotedetail", quoteProductID, set);
          var priceperunit = quote.Attributes["priceperunit"];
          var teamleader = quote.Attributes["new_disc"];
          var manualdiscountamount = quote.Attributes["manualdiscountamount"];
          var volumediscountamount = quote.Attributes["volumediscountamount"];
          var VAT = (int)quote.Attributes["new_vat"];
  
          var discountamount = (double)priceperunit * (double)teamleader / 100;
          var baseamount = (double)priceperunit - discountamount;
          var tax = baseamount * VAT / 100;
          var extendedamount = baseamount + tax;
          quote.Attributes["new_discountamount"] = discountamount;
          quote.Attributes["baseamount"] = baseamount;
          quote.Attributes["tax"] = tax;
          quote["description"] = priceperunit;
          quote.Attributes["extendedamount"] = extendedamount;
          service.Update(quote);
  
  
      }
  </code></pre>
  
  <p>Please, tell me if there is a way to access those fields and use/set them. </p>
  
  <p>Thanks in Advance!
  :/ </p>