Getting UD Field in BPM Custom Code

I have perused many posts about getting UD fields in BPMs>Execute Custom code, however my attempts are still showing up blank.

I’m trying to get this UD field from OrderRel here and assigning callContextBpmData.Date01 to it, but it keeps showing up blank. Am I missing something?

image

Erp.Tables.OrderRel OrderRel;

var ttShipDtlRow = (from row in ttShipDtl select row).FirstOrDefault();
var OrderRelRow = (from row in Db.OrderRel where ttShipDtlRow.Company == row.Company && ttShipDtlRow.OrderNum == row.OrderNum && ttShipDtlRow.OrderLine == row.OrderLine && ttShipDtlRow.OrderRelNum == row.OrderRelNum select row).FirstOrDefault();

if (OrderRelRow != null) {


  callContextBpmData.Date01 = OrderRelRow.UDField<DateTime>("Date01");
 
 }

You should not have to try that hard. The UD fields appear as standard fields in most cases… you should be able to simply call it out as OrderRelRow.Date01

I tried that, it still returned a blank unfortunately despite a value existing for the SO release I am shipping.

I am not sure which BPM you are doing this code in but if its Update for starters change to

var ttShipDtlRow = (from row in ttShipDtl where (row.Added() || row.Updated()) select row).FirstOrDefault();

The reason is that Epicor will pass in 2 rows during an Update. The Modified row and the Unmodified row, which it then uses to compare data to, make conditions work, changelog work.

Erp.CustShip.UpdateMaster to answer your question.

Perfect, try the change above, first. That may just solve your issue.

Also what Tim said use this format when you are reading a UD Field from a Db table in this case OrderRel. You should be fine with OrderRelRow.Date01 this works when not dealing with a ttTable in Method Directive.

1 Like

Thanks! It was either that or I never closed the Cust. Shipment Entry screen between making updates. :man_facepalming: