# Quote Duplication Custom Code BPM

**URL:** <https://www.epiusers.help/t/quote-duplication-custom-code-bpm/91302>\
**Category:** Kinetic ERP\
**Tags:** custom-code, bpm, epicor\
**Created:** [June 9, 2022, 11:22am UTC](https://www.epiusers.help/t/quote-duplication-custom-code-bpm/91302 "2022-06-09T11:22:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lee\_Fry](https://www.epiusers.help/user_avatar/www.epiusers.help/lee_fry/32/17628_2.png) [@Lee\_Fry](https://www.epiusers.help/u/Lee_Fry)\
**Post date:** [June 9, 2022, 11:22am UTC](https://www.epiusers.help/t/quote-duplication-custom-code-bpm/91302/1 "2022-06-09T11:22:46Z")

</div>

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?

 ![Screenshot from 2022-06-09 12-15-53](https://www.epiusers.help/uploads/default/original/3X/5/7/577120d7118511b92c67bcaf1546aa05ecd9be4f.png)

This is the custom code that we use:

```auto
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

---

<div class="post-metadata">

**Author:** ![Lee\_Fry](https://www.epiusers.help/user_avatar/www.epiusers.help/lee_fry/32/17628_2.png) [@Lee\_Fry](https://www.epiusers.help/u/Lee_Fry)\
**Post date:** [August 16, 2022, 11:27am UTC](https://www.epiusers.help/t/quote-duplication-custom-code-bpm/91302/2 "2022-08-16T11:27:35Z")

</div>

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
