null金额值salesorderdetail on crm 2011-Silverlight

时间:2013-01-07 22:24:52

标签: c# silverlight dynamics-crm-2011

我正在尝试在SalesOrderDetail实体上插入数据,一切正常,但Amount字段保持为null。我没有收到任何错误消息。 以下是我的代码示例:

private void beginCreateSalesOrderDetail()
{
    SalesOrderDetail orderDetail = new SalesOrderDetail();
    orderDetail.SalesOrderId = new EntityReference() 
    { 
       Id = id, 
       LogicalName = "salesorder" 
    };
    orderDetail.Quantity = element.QuantityOnHand;
    orderDetail.ProductId = new EntityReference() 
    { 
        Id = element.ProductId, 
        LogicalName = "product" 
    };
    orderDetail.UoMId = new EntityReference() 
    { 
        Id = new Guid("8DDD2AFB-73CF-E111-8140-00155D55B216"),        
        LogicalName = "uom" 
    };
    orderDetail.TransactionCurrencyId = new EntityReference() 
    { 
        Id = new Guid("77D695B5-ACB4-E111-97BC-00155D55B216"), 
        LogicalName = "transactioncurrency" 
    };

    Money Taxe = new Money(); 
    Money Amount = new Money();
    Taxe.Value = Convert.ToDecimal(element.totalCharges);
    Amount.Value = Convert.ToDecimal(InvoiceTotal);
    orderDetail.Tax = Taxe;
    orderDetail.BaseAmount = Amount;
    orderDetail.PricePerUnit = element.Price;
    orderDetail.Description = element.PDesc;
   _context.AddToSalesOrderDetailSet(orderDetail);
 _context.BeginSaveChanges(EndCreateSalesOrderDetail, orderDetail);

}



private void EndCreateSalesOrderDetail(IAsyncResult result)
  {

     try
     {
       _context.EndSaveChanges(result);
     }
            catch (Exception ex)
            {
            }

   }    

请注意,只有保留空的金额

1 个答案:

答案 0 :(得分:1)

我得到了解决方案。 实际上,2011年crm有一个限制来计算产品数量, 我们必须创建价格表,并将列表中的每个产品关联起来。 谢谢。