As additional information, I tried to do the following:
PurchaseOrder p = OrderContext.Current.GetPurchaseOrderById(1817); OrderGroupWorkflowManager.RunWorkflow(p, OrderGroupWorkflowManager.OrderRecalculateWorkflowName);
But when running the workflow, a NullreferenceException is raised (and I made sure through debugger that PurchaseOrder p is not null).
Did you try with
OrderGroupWorkflowManager.RunWorkflow(p, OrderGroupWorkflowManager.OrderRecalculateWorkflowName, false); ?
Thanks for answering, Quan Mai. Unafortunately, even though an exception is not raised, the purchase is not update with new discounts as I'd wish.
I'm on a situation where I need to update already existing purchases. There are new discounts and prices that should be applied to several previous purchases and, therefore, totals, gross totals, shipments, etc... should be recalculated. Is it any way to quickly update a purchase order besides having to recreate it again?
Thank you and kind regards,