Copy UD fields from Quote header to order header when converting quote to order

There is not a field mapping for QuoteHed to OrderHed. You would think there was but there is not. I opened a case, & they converted to a problem but in the end they (Epicor development) closed the problem without resolution. I have to look back to see what there official answer was. I have not persured it further, but will be looking at writing the custom code solution to bring about 6 UD fields over from QuoteHed to OrderHed. When We first looked at this project we were on 10.1.400.38, we are now on 10.2.300.15 still no predefiend mapping from Epicor.

1 Like

Hello Bart, did this ever get added, Iā€™m using 10.2.400.13 and canā€™t see it

Lawson, We reported this, it got escalated to a problem (PRB0191667) but was then ā€œrejectedā€ without any further correspondence or reasons given (reminding me of the soup Nazi on Seinfeldā€¦NO SOLUTION FOR YOUā€¦lol) We are testing 10.2.600.4 not there either. I ended up adding custom code to copy the fields over from quote to sales order when converting the quote.

hmm sounds like a good place for a functionā€¦ one that could even be shared.

Andrew, I think itā€™s maybe because most things in Epicor are based on individual linesā€¦
Although we can convert a quote to a sales order we can also pull in lines from multibale quotes to the same sales order

Andrew, Iā€™d also be interested in having a look at your custom code, the ttOrder doesnā€™t seem to be available in the pre and post method directives when using the CreateOrder directive

Sorry for the delay. here is the Custom Code I have inserted in (2) method directives:

Code Block

Erp.Tables.OrderHed OrderHed;
Erp.Tables.QuoteHed QuoteHed;
var ttOrderHedRow = (from ttOrderHed_Row in ttOrderHed
            where string.Compare(ttOrderHed_Row.Company, Session.CompanyID, true) == 0
            select ttOrderHed_Row).FirstOrDefault();
if (ttOrderHedRow != null)
{
    OrderHed = (from OrderHed_Row in Db.OrderHed
                where string.Compare(OrderHed_Row.Company, Session.CompanyID, true) == 0
                  && OrderHed_Row.OrderNum == ttOrderHedRow.OrderNum
                select OrderHed_Row).FirstOrDefault();
    if (OrderHed != null)
    {
        QuoteHed = (from QuoteHed_Row in Db.QuoteHed
                    where string.Compare(QuoteHed_Row.Company, Session.CompanyID, true) == 0
                      && QuoteHed_Row.QuoteNum == iQuoteNum
                    select QuoteHed_Row).FirstOrDefault();
        if (QuoteHed != null)
        {
            OrderHed.Industry_Type_c = QuoteHed.Industry_Type_c;
            OrderHed.Industry_Seg_c = QuoteHed.Industry_Seg_c;
            OrderHed.Character01 = QuoteHed.Character01;
            OrderHed.Character02 = QuoteHed.QuotedTo_c;
            OrderHed.Character03 = QuoteHed.QuoteToEmail_c;
            OrderHed.Character04 = QuoteHed.ModelNoRef_c;
            OrderHed.Character05 = QuoteHed.SerialNoRef_c;
            OrderHed.Forecasted_c = QuoteHed.Forecasted_c;
            //OrderHed.MkgtDiscvrExt_c = QuoteHed.MkgtDiscvrExt_c;
            OrderHed.CheckBox03 = QuoteHed.NewProj_c;
            OrderHed.CheckBox04 = QuoteHed.RepProj_c;
        }
    }
}

I have that cusotm code on these two method directives:
Erp.Quote.CreateOrder
and Erp.SalesOrder.CreateOrderFromQuote.

I use the below code as an In Transaction Data Directive on the OrderDtl to copy UD fields from the quote when creating an order. You can adjust it to your needs. It may not be the best way but it works for me.

Erp.Tables.QuoteDtl QuoteDtl;
foreach (var ttOrderDtl_iterator in (from ttOrderDtl_Row in ttOrderDtl
         where ttOrderDtl_Row.Company == Session.CompanyID
					&& string.Equals(ttOrderDtl_Row.RowMod, IceRow.ROWSTATE_ADDED, StringComparison.OrdinalIgnoreCase)
					&& ttOrderDtl_Row.QuoteNum != 0
					&& ttOrderDtl_Row.QuoteLine != 0
          select ttOrderDtl_Row))
{
    var ttOrderDtlRow = ttOrderDtl_iterator;
    QuoteDtl = (from QuoteDtl_Row in Db.QuoteDtl
         where QuoteDtl_Row.Company == Session.CompanyID
					&& QuoteDtl_Row.QuoteNum == ttOrderDtlRow.QuoteNum
					&& QuoteDtl_Row.QuoteLine == ttOrderDtlRow.QuoteLine
          select QuoteDtl_Row).FirstOrDefault();
		if (QuoteDtl != null)
			{
			ttOrderDtlRow["Character01"] = (string)QuoteDtl["Character01"];
			ttOrderDtlRow["Character02"] = (string)QuoteDtl["Character02"];
			ttOrderDtlRow["Character03"] = (string)QuoteDtl["Character03"];
			ttOrderDtlRow["FormattedRefs_c"] = (string)QuoteDtl["FormattedRefs_c"];
			ttOrderDtlRow["Number04"] = QuoteDtl["Number04"];
			ttOrderDtlRow.ShipComment = (string)QuoteDtl["FormattedRefs_c"];
			if (QuoteDtl.AnalysisCode == "RWK")
				{
					ttOrderDtlRow.Rework = true;
				}
			ttOrderDtlRow["CheckBox03"] = (bool)QuoteDtl["CheckBox03"];        
			ttOrderDtlRow["Character05"] = QuoteDtl.OriginalPartNo_c;        
			ttOrderDtlRow["DrawingNumber_c"] = (string)QuoteDtl.DrawNum;
			ttOrderDtlRow["CheckBox02"] = (bool)QuoteDtl["CheckBox02"];				       
			QuoteDtl["CheckBox06"] = true;
			Db.Validate();
			}
}

Best regards
Adrian.

2 Likes

what you have achieved here is exactly what i am looking to replicate, however i am getting errors with the code, the variables are not working for me and i am unable to set the variables or unsure how to!

would you be able to possibly point me in the correct directionā€¦

What code errors are you getting? My code includes user defined fields on both the Quote Head and Order Head tables, you would have to substitute your field names for my custom UD fields.

I kinda get why there isnā€™t one, but I sure wish there was a UD Code Map for Quote Header to Order Header.

2 Likes

Try looking at the examples here:
https://www.epiusers.help/t/bpm-to-copy-ud-fields-from-quotedtl-to-orderdtl-when-creating-order-from-quote/103841/19?u=itsme

1 Like

the problem I have is the fields I need to reference are in a table called UD01, not on the QuoteDtl or OrderDtl - everything I am trying to use from examples just isnā€™t working, the closest I have came to a solution I could test is one that @itsme suggested I look at.

Simplest this is a DD to get this done because the Order from Quote launches different process than Quote to Order.

so are you intending to copy fields from the UD01 table to the Quote and or Sales Order Header tables?