We are wanting to implement a Steel Surcharge (OrderMsc) added to Order Entry to specific line items (OrderDtl) based on part product groups. I currently have a semi-working BPM that is doing this in our test environment. I am currently working with the Erp.SalesOrder.Update method and using a Post-Processing BPM. I have uploaded a copy of my BPM for what I have so far. I am using the Update method because I would like this BPM to fire anytime a Part, Quantity, and/or Unit Price is either added or changed on the OrderDtl record.
First I have a condition that checks to see if there are any OrderDtl records and if there are then I check to see if an OrderMsc record already exists for Steel Surcharge. If there is not a OrderMsc then I am verifying if the part being entered on the line belongs to one of the product groups we will be adding the Steel Surcharge to. If it is then I am invoking a BO Method for Erp.SalesOrder.GetNewOrderMsc and then invoking the BO Method for Erp.SalesOrder.ChangeMiscCode. Then from here I am manually setting each of the fields to the values I want on the Surcharge. This is working but I was hoping I could just pull in the MiscCode from the Surcharge that was created in Epicor and not needing to set the fields for everything manually, including the percentage value, the ttOrderMsc.MiscAmt, and the ttOrderMsc.DocMiscAmt. Lastly I am invoking the BO Method of Erp.SalesOrder.MasterUpdate to update the database with my changes.
While this BPM is working and it does add the charge to the line items based on my criteria, I would much rather have the system calculate the amounts based on the percent that is on the miscellaneous charge in Epicor, is this possible?
I am also having an issue of removing the surcharge if the part is originally entered for a product group that gets the surcharge but then the line (OrderDtl) is updated so be a part that would no longer need the surcharge added. Currently in the BPM it is simply showing an informational message alerting the user to manually remove the charge, but I would prefer to have the system remove it if a condition is met. Can someone please help me with this.
While I do have a lot of experience with C# and BPM’s I have never created a BPM that creates or deletes records in the database before with using the system’s business logic. In the past most of the BPM’s we have created are either updating records already created based on criteria or outputting data from Epicor to Excel or emailing. I am sure there is a better way to do this with code than using Epicor’s built in BPM processes which is why I am posting this question for the groups help. I am fairly new to this group but I have been using Epicor 10/Epicor 9/Vantage 8 for over 11 years now.
Any help that anyone can offer will be appreciated. Thank you!
Thank you very much for the reply on this. I tried modifying the BPM based on your suggestion and it worked as needed for auto calculating the amounts and percent for the msic. charge. Would you also be able to assist me with how to remove the misc. charge from the OrderDtl line if the part is changed to a non-surcharge needed item? In the BPM that I originally uploaded the verification was done but I was simply displaying an informational message, instead of the message I would just want to remove the associated surcharge from the line.
I’m trying to do something similar. I downloaded the copy of the BPM in the first post to review. However, I’m wondering if this works for an Order that has multiple lines? The BPM I created for this is similar and works great for just 1 line, but I am getting errors about more than one ttOrderDtl record existing if I add a second line to the order.
Sorry for the delay. I did get this working. I had to create a UD field on the OrderDtl to be marked as True if charges need to be added. I did this with a Post-Processing directive on SalesOrder.ChangePartNumMaster when OrderDtl.RowMod = A. I then created a Pre-Processing directive on SalesOrder.Update where I assigned various information (OrderNum, CustNum, ProdCode) to different callContextBPMData fields to use in a Post-Processing directive since I could not find this needed data in the dataset of the Post-Processing directive. This also gets called when OrderDtl.RowMod = A. The Post-Processing directive then gets enabled and uses the values stored in the callContextBPMData fields to assign certain charges based on their values, and I also had to use them for parameters in the SalesOrder.GetNewOrderMsc and SalesOrder.Update methods I had to invoke in the process.
Basically, this series of BPM’s gets called every time a Line is added and checks for the Product Group and the Plant creating the line so the correct Misc. Charge gets added.
If you need more detail (screen shots, code, etc.), or have any other questions, let me know, I’ll be glad to help.