Quote Duplication Custom Code BPM

Hello,

We currently reviewing Kinetic 2022.1 as an upgrade path from our current 10.2, there has clearly been loads of changes, and we have alot of work to do before going live.
Currently we are planning on keeping to the old UI instead of Kinetic web- then slowly porting/rewriting our configurators to make them in App Studio etc.

I’m just starting to go through some of our Custom Code BPM’s, in one when a quote is duplicated we copy across the PO Reference- when attempting to duplicate a quote with the BPM active in 2022.1 we get the following error. Everything works correctly on 10.2, is there simple changes to the custom code I can make to get this working in 2022.1 desktop app?

This is the custom code that we use:

Erp.Tables.QuoteDtl QuoteDtl;
var newQuoteHed = result.QuoteHed;
var newQuoteNum = newQuoteHed[0].QuoteNum;

var copiedFromQuoteNum = sourceQuote;


var oldQuote = (from QuoteHed in Db.QuoteHed
                 where QuoteHed.Company == Session.CompanyID
                 && QuoteHed.QuoteNum == copiedFromQuoteNum
                 select QuoteHed).FirstOrDefault();
                
if (oldQuote != null)
{
    if(!string.IsNullOrEmpty(oldQuote.Reference))
    {      
      var newQuote = (from QuoteHed in Db.QuoteHed
                   where QuoteHed.Company == Session.CompanyID
                   && QuoteHed.QuoteNum == newQuoteNum
                   select QuoteHed).FirstOrDefault();
    
      if (newQuote != null)
      {
        newQuote.Reference = oldQuote.Reference;        
      }
    }
}

Thanks
Lee

I have still be unable to fix this issue, I forgot to mention that this is a Post-Processing BPM method directive on the DuplicateQuote.

Is anyone able to assist in what has changed, or why this no longer works with newer epicor versions?

Many Thanks
Lee