QuoteDtl not updated correctly when invoking Update BO method

When duplicating a quote (actions > quote > duplicate quote), my company uses a BPM to copy some quote line details from the original quote to the new quote. The problem is that when we upgraded our test environments to 2023.2 we discovered that the fields from QuoteDtl are not being copied correctly. For example, the order quantity on the original quote equals 6, but on the duplicate quote the quantity equals 1. Now here’s the fun part, we also copy some data from QuoteHead and that works just fine.

Our BPM resides in the Quote.DuplicateQuote BO method. I used a widget to invoke the GetByID method which populates a tableset variable of type QuoteTableset. In our custom code we query QuoteHed in this tableset and change the values of a few fields including the RowMod to “U”. Then we query QuoteDtl from that tableset as well as query the original quote details from the database. A foreach loop then looks through each line in the new quote and sets field values to the corresponding values in the old quote. This includes setting the RowMod to “U”. After the custom code widget, the Quote.Update BO method is invoked via a widget and updates the database from the tableset variable. (Screenshot of some of the custom code down below.)

When I duplicate a quote, the fields I set in Quote head copy over, but the OrderDtl values do not. I narrowed down the issue to the Quote.Update BO method by turning off all other BPM’s except the one I’m working on. I also confirmed that the fields I’m changing are changed in the tableset before I use it to update the database. I’ve spent quite a bit of time pouring though stack traces looking for any other methods and/or BPM’s being triggered that could change the data after the update I invoked, but I’ve found nothing. This is starting to smell like a bug. Why would I be able to update header details, but not line details?

Try copying the data from the QuoteQty table. Thats where the key qty and price details are stored.

I gave that a go this morning but it didn’t fix the problem. By using message boxes, I know that the data I’m querying and then changing in the tableset I defined is all working as designed. It all goes wrong during the update. Again, I turned off any BPM’s we have on Quote.Update to make sure we don’t have code there causing this issue. It seems like there is a bug in the base processing of that method.

The Quote.DuplicateQuote() method clears the Unit Price and Quantities. This is base functionality. Epicor support will tell you that this is working as expected.

You’ll need to loop through the new quote lines after they are created and update the price and quantities then call Quote.Update()

Right, and so we built our BPM in the post processing so that our changes could be applied after the base functionality.