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?
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 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.
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.