I was trying to place sales order through Web API and wanted to uncheck the "Manual Discount" checkbox so I tried to use following code:
SO301000Content SO301000 = context.SO301000GetSchema();
context.SO301000Clear();
List<Command> cmds = new List<Command>();
cmds.Add(new Value { Value = "SO", LinkedCommand = SO301000.OrderSummary.OrderType });
cmds.Add(new Value { Value = "<NEW>", LinkedCommand = SO301000.OrderSummary.OrderNbr });
cmds.Add(new Value { Value = orderInfo.OrderCustomerInfo.AcctCD, LinkedCommand = SO301000.OrderSummary.Customer });
cmds.Add(new Value { Value = orderInfo.OrderLocationInfo.ID, LinkedCommand = SO301000.OrderSummary.Location });
cmds.Add(new Value { Value = orderInfo.ShippingTotal.ToString(), LinkedCommand = SO301000.Totals.PremiumFreight });
cmds.Add(new Value { Value = "30D", LinkedCommand = SO301000.FinancialSettingsFinancialInformation.Terms});
cmds.Add(new Value { Value = orderInfo.PromoCode, LinkedCommand = SO301000.DocumentDetails.DiscountCode });
//add line items
foreach (OrderItem item in orderInfo.OrderItems)
{
cmds.Add(SO301000.DocumentDetails.ServiceCommands.NewRow);
cmds.Add(new Value { Value = item.InventoryCD, LinkedCommand = SO301000.DocumentDetails.InventoryID });
cmds.Add(new Value { Value = item.Quantity.ToString(), LinkedCommand = SO301000.DocumentDetails.Quantity });
cmds.Add(new Value { Value = "Server", LinkedCommand = SO301000.DocumentDetails.Warehouse });
cmds.Add(new Value { Value = "False", LinkedCommand = SO301000.DocumentDetails.ManualDiscount});
cmds.Add(new Value { Value = "Discount1", LinkedCommand = SO301000.DocumentDetails.DiscountCode});
cmds.Add(new Value { Value = "20", LinkedCommand = SO301000.DocumentDetails.DiscountPercent });
}
cmds.Add(SO301000.Actions.Save);
cmds.Add(SO301000.OrderSummary.OrderNbr);
cmds.Add(SO301000.OrderSummary.OrderTotal);
cmds.Add(SO301000.OrderSummary.TaxTotal);
cmds.Add(SO301000.OrderSummary.Location);
cmds.Add(SO301000.OrderSummary.Customer);
SO301000Content[] SO30100content = context.SO301000Submit(cmds.ToArray());
.......................
however, after the sales order is placed, I found the "Manual Discount" checkbox was still checked and discount I have set to automatically be applied was not applied at all.
I found an old thread about this issue at http://forum.acumatica.com/forum/acumatica-reseller-and-isv-community/development-and-customization/895-order-creation-through-soap-call-with-manual-discosunt-false-not-working, in which a guy said this was a bug, however, that was about 3 years ago. so I assume this bug should have been fixed already...if it is not bug any more, can somebody tell me what I did wrong?
Thanks.
Just did more testing following the suggestion from @Gabriel but the "Manual Discount" was still checked after the order is placed through web service, however, when I tried to place a new order through screen and add same item, the "Manual Discount" was not checked by default. I don't know what was wrong in my code.
Here is the code I just tried and no luck to get discount automatically applied:
SO301000Content SO301000 = context.SO301000GetSchema();
context.SO301000Clear();
List<Command> cmds = new List<Command>();
cmds.Add(new Value { Value = "SO", LinkedCommand = SO301000.OrderSummary.OrderType });
cmds.Add(new Value { Value = "<NEW>", LinkedCommand = SO301000.OrderSummary.OrderNbr });
cmds.Add(new Value { Value = orderInfo.OrderCustomerInfo.AcctCD, LinkedCommand = SO301000.OrderSummary.Customer });
cmds.Add(new Value { Value = orderInfo.OrderLocationInfo.ID, LinkedCommand = SO301000.OrderSummary.Location });
cmds.Add(new Value { Value = orderInfo.ShippingTotal.ToString(), LinkedCommand = SO301000.Totals.PremiumFreight });
cmds.Add(new Value { Value = "30D", LinkedCommand = SO301000.FinancialSettingsFinancialInformation.Terms});
//cmds.Add(new Value { Value = orderInfo.PromoCode, LinkedCommand = SO301000.DocumentDetails.DiscountCode });
//add line items
foreach (OrderItem item in orderInfo.OrderItems)
{
cmds.Add(SO301000.DocumentDetails.ServiceCommands.NewRow);
cmds.Add(new Value { Value = item.InventoryCD, LinkedCommand = SO301000.DocumentDetails.InventoryID });
cmds.Add(new Value { Value = item.Quantity.ToString(), LinkedCommand = SO301000.DocumentDetails.Quantity });
//cmds.Add(new Value { Value = "Server", LinkedCommand = SO301000.DocumentDetails.Warehouse });
//cmds.Add(new Value { Value = "False", LinkedCommand = SO301000.DocumentDetails.ManualDiscount});
//cmds.Add(new Value { Value = "VOLWHMIS", LinkedCommand = SO301000.DocumentDetails.DiscountCode});
//cmds.Add(new Value { Value = "100", LinkedCommand = SO301000.DocumentDetails.DiscountPercent });
}
cmds.Add(SO301000.Actions.Save);
cmds.Add(SO301000.OrderSummary.OrderNbr);
cmds.Add(SO301000.OrderSummary.OrderTotal);
cmds.Add(SO301000.OrderSummary.TaxTotal);
cmds.Add(SO301000.OrderSummary.Location);
cmds.Add(SO301000.OrderSummary.Customer);
SO301000Content[] SO30100content = context.SO301000Submit(cmds.ToArray());