# BPM to Copy UD field Value from Part to QuoteDtl

**URL:** <https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542>\
**Category:** Epicor ERP 10\
**Tags:** e10, bpm\
**Created:** [July 28, 2017, 10:05pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542 "2017-07-28T22:05:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nhutchins](https://www.epiusers.help/user_avatar/www.epiusers.help/nhutchins/32/108_2.png) [@nhutchins](https://www.epiusers.help/u/nhutchins)\
**Post date:** [July 28, 2017, 10:05pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/1 "2017-07-28T22:05:27Z")

</div>

Happy Friday…

I think this should be relatively easy, but I’m having a Friday afternoon brainfart and think it’s time to go home.

I have a UD field on the Part table **_(Part.SaleLeadTime\_c_**) and I want it to populate a field on the QuoteDtl table ( **_QuoteDtl.LeadTime_** ) when Part is added or changed on the Quote line.

I know the Method is **_Quote.ChangePartNumMaster_** , but no matter what I try it isn’t working…

Any pointers would be great. Thanks!

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lang](https://www.epiusers.help/user_avatar/www.epiusers.help/jonathan_lang/32/63295_2.png) [@Jonathan\_Lang](https://www.epiusers.help/u/Jonathan_Lang)\
**Post date:** [July 29, 2017, 12:18am UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/2 "2017-07-29T00:18:04Z")

</div>

I did something similar, but wanted to populate 2 fields from Quote to Sales:

> Erp.Tables.Part Part;

> {  
> foreach (var ttQuoteDtl\_xRow in (from ttQuoteDtl\_Row in ttQuoteDtl   
> where (ttQuoteDtl\_Row.Company == Session.CompanyID &&  
> (ttQuoteDtl\_Row.RowMod == “A” || ttQuoteDtl\_Row.RowMod == “U”))  
> select ttQuoteDtl\_Row))  
> {  
> if (ttQuoteDtl\_xRow != null)  
> {  
> /\* For each line on the Quote - retrieve UD Fields from Part table\*/  
> Part = (from Part\_Row in Db.Part  
> where Part\_Row.Company == ttQuoteDtl\_xRow.Company && Part\_Row.PartNum == partNum  
> select Part\_Row).FirstOrDefault();  
> {  
> if (Part != null)  
> {  
> ttQuoteDtl\_xRow[“ConfigComment1\_c”] = Convert.ToString(Part[“ConfigComment1\_c”]);  
> ttQuoteDtl\_xRow[“ConfigComment2\_c”] = Convert.ToString(Part[“ConfigComment2\_c”]);

> ```
> }
> else /* Part not found - initialize fields */
> {
> ttQuoteDtl_xRow["ConfigComment1_c"] = "";
> ttQuoteDtl_xRow["ConfigComment2_c"] = "";
> 
> ```

> ```
> }
> } 
> }	
> 
> ```

Yours shouldn’t be too much different.

---

<div class="post-metadata">

**Author:** ![jdtrent](https://www.epiusers.help/user_avatar/www.epiusers.help/jdtrent/32/915_2.png) [@jdtrent](https://www.epiusers.help/u/jdtrent)\
**Post date:** [July 29, 2017, 3:39am UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/3 "2017-07-29T03:39:08Z")

</div>

Yes, as posted in the example,

ttQuoteDtl\_xRow[“ConfigComment1\_c”] = “”;

works, but

ttQuoteDtl\_xRow.ConfigComment1\_c = “”;

doesn’t. For me, anyway.

Joe

---

<div class="post-metadata">

**Author:** ![nhutchins](https://www.epiusers.help/user_avatar/www.epiusers.help/nhutchins/32/108_2.png) [@nhutchins](https://www.epiusers.help/u/nhutchins)\
**Post date:** [August 2, 2017, 9:46pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/4 "2017-08-02T21:46:58Z")

</div>

Thanks, @Jonathan_Lang & @jdtrent, for your help.

I’m just getting back to this today, and I’m still failing. Guess I can’t blame Friday Friday noon after all. I think I now know why it’s not working, but I’m not sure how to fix it.

Also, I’m not trying to set the UD field; I’m trying to set the QuoteDtl.Leadtime field to the value in the UD field.

Here’s what I have;

- Pre-Processing Method Direct on Epr.Quote.ChangePartNumMaster
- Execute Custom Code

```cs
var QDtlRow = ( from ttQuoteDtl_row in ttQuoteDtl 
			   where (ttQuoteDtl_row.RowMod == "A" || ttQuoteDtl_row.RowMod == "U") 
			   select ttQuoteDtl_row).FirstOrDefault();
Erp.Tables.Part Part;

if (QDtlRow != null)
{
	PublishInfoMessage("QDtlRow != null & PartNum=" + QDtlRow.PartNum, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "QDtlRow != null", "Update");

	Part = (from Part_Row in Db.Part
		    where (Part_Row.Company == QDtlRow.Company && Part_Row.PartNum == QDtlRow.PartNum)
		    select Part_Row).FirstOrDefault();
	
	if (Part != null)
	{
		PublishInfoMessage("Part != null", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "Part != null", "Update");
		
		QDtlRow.LeadTime = Part.SaleLeadTime_c.ToString();
	}
}

```

I get the first message box; however the QDtlRow.PartNum is blank, which is why it’s not working.

---

<div class="post-metadata">

**Author:** ![danbedwards](https://www.epiusers.help/letter_avatar_proxy/v4/letter/d/9f8e36/32.png) [@danbedwards](https://www.epiusers.help/u/danbedwards)\
**Post date:** [August 2, 2017, 10:55pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/5 "2017-08-02T22:55:31Z")

</div>

Dumb question here, but are you possibly switching from a part, not in the part master, to one that is? The code worked fine when I tried it, except for that scenario.

---

<div class="post-metadata">

**Author:** ![nhutchins](https://www.epiusers.help/user_avatar/www.epiusers.help/nhutchins/32/108_2.png) [@nhutchins](https://www.epiusers.help/u/nhutchins)\
**Post date:** [August 2, 2017, 11:30pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/6 "2017-08-02T23:30:30Z")

</div>

@danbedwards, at this point there are no dumb questions. However, yes this is a part in the part master, and I set a Sales Price of 999.00, which does copy over.

When you say;

> The code worked fine when I tried it

Are you talking about the code I just posted?

---

<div class="post-metadata">

**Author:** ![danbedwards](https://www.epiusers.help/letter_avatar_proxy/v4/letter/d/9f8e36/32.png) [@danbedwards](https://www.epiusers.help/u/danbedwards)\
**Post date:** [August 2, 2017, 11:38pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/7 "2017-08-02T23:38:13Z")

</div>

Yes, I thought that was still giving you problems.

---

<div class="post-metadata">

**Author:** ![nhutchins](https://www.epiusers.help/user_avatar/www.epiusers.help/nhutchins/32/108_2.png) [@nhutchins](https://www.epiusers.help/u/nhutchins)\
**Post date:** [August 2, 2017, 11:38pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/8 "2017-08-02T23:38:58Z")

</div>

Yes, it is… so why is it working for you… 😑

---

<div class="post-metadata">

**Author:** ![danbedwards](https://www.epiusers.help/letter_avatar_proxy/v4/letter/d/9f8e36/32.png) [@danbedwards](https://www.epiusers.help/u/danbedwards)\
**Post date:** [August 2, 2017, 11:58pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/9 "2017-08-02T23:58:59Z")

</div>

I guess when I say working I can get a value back and populate the field. The part number it does use is the original and not the new part number. I assume you want to change to a new part number and look up the Part.SaleLeadTime\_c on the new part record, correct? I would use ChangePartNum (not Master) and this will work for you.

---

<div class="post-metadata">

**Author:** ![josecgomez](https://www.epiusers.help/user_avatar/www.epiusers.help/josecgomez/32/55731_2.png) [@josecgomez](https://www.epiusers.help/u/josecgomez)\
**Post date:** [August 3, 2017, 10:45am UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/10 "2017-08-03T10:45:23Z")

</div>

Try moving your code to post processing

---

<div class="post-metadata">

**Author:** ![Chris\_Conn](https://www.epiusers.help/user_avatar/www.epiusers.help/chris_conn/32/93797_2.png) [@Chris\_Conn](https://www.epiusers.help/u/Chris_Conn)\
**Post date:** [August 3, 2017, 1:18pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/11 "2017-08-03T13:18:04Z")

</div>

Perhaps a moot point considering the meat of the discussion but regarding using:  
ttQuoteDtl\_xRow[“ConfigComment1\_c”] = “”;  
vs  
ttQuoteDtl\_xRow.ConfigComment1\_c = “”;

Instead of using foreach (var ttQuoteDtl\_xRow in (from ttQuoteDtl\_Row in ttQuoteDtl -

Add Using Erp.Tablesets and the change the var to QuoteDtlRow.

Will it work? I don’t know! Presumably is would force the strong typed class and allow you to use the fields.

---

<div class="post-metadata">

**Author:** ![nhutchins](https://www.epiusers.help/user_avatar/www.epiusers.help/nhutchins/32/108_2.png) [@nhutchins](https://www.epiusers.help/u/nhutchins)\
**Post date:** [August 3, 2017, 1:50pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/12 "2017-08-03T13:50:40Z")

</div>

Thank you @danbedwards! I didn’t notice that there was a ChangePartNum & a ChangePartNumMaster. Putting the above code on the non-master BO solved the issue!

I knew I was missing something simple, I even messed around with an external dll, so I could run remote debugging to see if I could fix it, but had the same thing happen using the ChangePartNumMaster.

Thanks again!

---

<div class="post-metadata">

**Author:** ![Charles.Dingas](https://www.epiusers.help/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@Charles.Dingas](https://www.epiusers.help/u/Charles.Dingas)\
**Post date:** [August 7, 2018, 9:46pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/13 "2018-08-07T21:46:32Z")

</div>

I have a similar issue. I have two UD fields in OrderDtl and I want them to populate two UD fields in InvcDtl which are identical. I thought I could use a BPM without code, but I am thinking I will need it after reading this post. Any pointers?

---

<div class="post-metadata">

**Author:** ![knash](https://www.epiusers.help/user_avatar/www.epiusers.help/knash/32/74179_2.png) [@knash](https://www.epiusers.help/u/knash)\
**Post date:** [August 7, 2018, 10:02pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/14 "2018-08-07T22:02:22Z")

</div>

What is the point of storing the same data in two locations? Can you not just join the tables to get to the fields?

Not that two fields is a big deal, just could see this method get out of control in the long run.

---

<div class="post-metadata">

**Author:** ![Mike](https://www.epiusers.help/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@Mike](https://www.epiusers.help/u/Mike)\
**Post date:** [August 7, 2018, 10:19pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/15 "2018-08-07T22:19:30Z")

</div>

Because it may not always be the same I would guess. If you update your master file you don’t want to retroactively change all of your transaction records at the same time.

---

<div class="post-metadata">

**Author:** ![knash](https://www.epiusers.help/user_avatar/www.epiusers.help/knash/32/74179_2.png) [@knash](https://www.epiusers.help/u/knash)\
**Post date:** [August 7, 2018, 10:25pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/16 "2018-08-07T22:25:25Z")

</div>

good point.

I think a BPM should work though, when field changes update other ud field.

---

<div class="post-metadata">

**Author:** ![Charles.Dingas](https://www.epiusers.help/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@Charles.Dingas](https://www.epiusers.help/u/Charles.Dingas)\
**Post date:** [August 8, 2018, 12:59pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/17 "2018-08-08T12:59:23Z")

</div>

@knash, Mike is correct. It changes all the time. So I need it to copy whatever is in the field directly over. I have run a BPM several times (no code) and it will not copy the data from the field in OrderDtl to InvcDtl.

---

<div class="post-metadata">

**Author:** ![knash](https://www.epiusers.help/user_avatar/www.epiusers.help/knash/32/74179_2.png) [@knash](https://www.epiusers.help/u/knash)\
**Post date:** [August 8, 2018, 2:26pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/18 "2018-08-08T14:26:40Z")

</div>

what does it look like.

I would guess an conditional widget.  
Then a GetById widget  
Then a set widget  
Then an update widget

That isn’t working?

---

<div class="post-metadata">

**Author:** ![Charles.Dingas](https://www.epiusers.help/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@Charles.Dingas](https://www.epiusers.help/u/Charles.Dingas)\
**Post date:** [August 8, 2018, 2:48pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/19 "2018-08-08T14:48:11Z")

</div>

I’ve had different versions:  
Condition Widget  
Update Table by Query

I do not see GetById Widget.

Here is the screen shot of the latest one I’ve tried:

 ![image](https://epiusers.help/uploads/default/original/2X/d/d4e9385e35623495594815dc985fd2c438a78a8f.png)

---

<div class="post-metadata">

**Author:** ![knash](https://www.epiusers.help/user_avatar/www.epiusers.help/knash/32/74179_2.png) [@knash](https://www.epiusers.help/u/knash)\
**Post date:** [August 8, 2018, 5:00pm UTC](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542/20 "2018-08-08T17:00:44Z")

</div>

You will need to get the record you want to update, by using the Invoke BO Method widget

Fill/Set record by using a setter widget

Then Update it using the Invoke BO Method widget.

 ![Capture](https://epiusers.help/uploads/default/original/2X/4/4ab06915ca20cc657c427aa95fad1cae9c8d3a5e.JPG)

[Next page](https://www.epiusers.help/t/bpm-to-copy-ud-field-value-from-part-to-quotedtl/39542.md?page=2)
