Update UDF field from another Table's UDF field

Hello All,
New here so I apologize if similar has been asked before. I have the following ABL code in Epicor 9 to update the the RcvDtl.ShortChar10 and ShortChar09 in the table RcvDtl to match what is in the coresponding parts table:

For each ttRcvDtl where ttRcvDtl.RowMod = β€˜a’ No-Lock.
Find Part where Part.Company = ttRcvDtl.Company and
Part.PartNum = ttRcvDtl.PartNum No-Lock.
If available Part then do:
Assign ttRcvDtl.ShortChar10 = Part.ShortChar10.
Assign ttRcvDtl.ShortChar09 = Part.ShortChar09.
End.
End.

What is the best way to handle this in E10? Is there a C# code template equivalent for this procedure or should it be done through BPM β€œsetters”?

foreach(var rcv in ttRcvDtl.Where(r => r.Added())
{
 var part = Db.Part.Where(p => p.Company == rcv.Company &&
 p.PartNum == rcv.PartNum).FirstOrDefault();
 if(part != null)
  {
   rcv.ShortChar10 = part.ShortChar10;
   rcv.ShortChar09 = part.ShortChar09;
  }
}

//assuming this is PRE process
2 Likes

Works great. Thanks.

1 Like