How do I calculate the invoice total after calling xrm.ConvertSalesOrderToInvoice() in the MS Dynamics CRM 2015 SDK? -


i'm using crm 2015 portal sdk (microsoft.crmsdk.extensions 7.1.0 nuget), , trying create invoice based on existing sales order. can create invoice, total 0 until views invoice using dynamics crm ui - , can't find way force recalculation via sdk.

the sdk documentation (such is!) whopping great chm file included in sdk download, generated xmldoc comments - little in way of descriptions or examples. there's content @ https://msdn.microsoft.com/en-us/library/gg309408.aspx, includes couple of walkthroughs doesn't go detail.

here's code i'm running - inside action method in asp.net mvc 5 project:

public actionresult createinvoice(guid id) {   var xrm = new spotlightxrmservicecontext("connectionstrings.crm2015.spotlight");   var order = xrm.salesorderset.firstordefault(o => o.id == id);   var columns = new columnset(true);   var invoiceentity = xrm.convertsalesordertoinvoice(order.id, columns);   return(view(invoiceentity)); } 

after running code, invoice exists in crm database, , can see listed in crm ui navigating sales > invoices - invoice total zero. if click invoice in crm ui view it, behind scenes forces recalculation, because when invoice loads, total £154 (which total amount of original sales order)

the web app in question post-payment redirect our payment provider, need web application is:

  1. locate existing sales order
  2. create invoice associated order
  3. mark invoice paid
  4. mark sales order fulfilled

i appear have fallen @ first hurdle. ideas?


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -