I have a data directive running when we approve a Part Revision. I would like to store information from the BOM in a specific instance to PartRev.Number02 so that I can use it elsewhere for reports, form customisations, etc without having to drag the PartMtl table in.
This is the code I have for my Data Directive (I assume I have to use Custom Code as I need the information from the PartMtl table):
// Link to PartMtl table to update PartRev.Number02 with QtyPer of 1kg Material
Ice.Diagnostics.Log.WriteEntry("zBPM: PartRev.Update");
Erp.Tables.PartMtl PartMtl;
Ice.Diagnostics.Log.WriteEntry("zBPM: PartRev.Update - PartMtl Table added");
foreach (var ttPartRev_iterator in (from ttPartRev_Row in ttPartRev
where string.Equals(ttPartRev_Row.RowMod, IceRow.ROWSTATE_UPDATED, StringComparison.OrdinalIgnoreCase)
&& ttPartRev_Row.Company == Session.CompanyID
select ttPartRev_Row))
{ var ttPartRev_Row = ttPartRev_iterator;
PartMtl = (from PartMtl_Row in Db.PartMtl
where PartMtl_Row.Company == ttPartRev_Row.Company
&& PartMtl_Row.PartNum == ttPartRev_Row.PartNum
&& PartMtl_Row.RevisionNum == ttPartRev_Row.RevisionNum
&& PartMtl_Row.MtlPartNum.StartsWith("1kg")
select PartMtl_Row).FirstOrDefault();
Ice.Diagnostics.Log.WriteEntry("zBPM: PartRev.Update - PartMtl.PartNum - Revision - MtlPartNum - QtyPer: " + PartMtl.PartNum + " - " + PartMtl.RevisionNum + " - " + PartMtl.MtlPartNum + " - " + PartMtl.QtyPer);
{
if (PartMtl != null)
Ice.Diagnostics.Log.WriteEntry("zBPM: PartRev.Update - PartMtl.PartNum - Revision - ttPartRev.Revision: " + PartMtl.PartNum + " - " + PartMtl.RevisionNum + " - " + ttPartRev_Row.RevisionNum);
Ice.Diagnostics.Log.WriteEntry("zBPM: PartRev.Update - PartMtl.PartNum - Revision - ttPartRev.Revision + ttPartRev.Number02 BEFORE: " + PartMtl.PartNum + " - " + PartMtl.RevisionNum + " - " + ttPartRev_Row.RevisionNum + " - " + ttPartRev_Row.Number02);
ttPartRev_Row.Number02 = PartMtl.QtyPer;
Ice.Diagnostics.Log.WriteEntry("zBPM: PartRev.Update - PartMtl.PartNum - Revision - ttPartRev.Revision + ttPartRev.Number02 AFTER: " + PartMtl.PartNum + " - " + PartMtl.RevisionNum + " - " + ttPartRev_Row.RevisionNum + " - " + ttPartRev_Row.Number02);
Db.Validate();
}
}
The lines below from the Server Log show that the code is running:
But when I run my BAQ to verify the field hasn’t updated:
![]()
Is it because I am updating a temp table \ ud field? I feel I must be missing something obvious but am running out of ideas of where to look.

