Hello,
I am trying to create a BPM, for Sales Order Entry, that will recalculate the Unit Price of a line item if the Order Quantity of that line item is changed. We are looking to keep the same Order Total when the Order Quantity of a line item is changed. To do that, we are currently recalculating the Unit Price by hand to keep the same Order Total. The calculation is (old QTY * old Unit Price)/(new QTY) = new Unit Price.
The tables and fields I believe I should be working with are OrderDtl.DocDspUnitPrice for Unit Price, OrderDtl.SellingQuantity for Order Quantity, and OrderHed.DocOrderAmt for Order Total.
I am creating a pre-processing Method Directive for the Erp.SalesOrdHedDtl Business Object, Update Method. I have a condition of “The ttOrderDtl.SellingQuantity field has been changed from any to another.” Then I have this condition pointing to a custom code caller. The custom code is where I am running into issues. I feel like it is easy but I have no experience in C# coding so that’s made this a little difficult.
The code was my problem, however, now I am seeing that there is a SalesOrder Business Object with a lot more methods than the SalesOrdHedDtl BO. I thought I should be using the BO I started with but now I am second guessing myself and am wondering if I am even working in the correct BO/method? Or should I be working with a data directive and not even a method directive?
Any direction that someone could point me towards would be much appreciated!