BPM To Assign Lot Number for Non-Conformance

I am trying to write a BPM to auto assign the lot number when a non-conformance is written against a job material. Right now Epicor lets you pick any lot number even if it’s not the lot that was assigned to the job. I have a pre-processing on NonConf.OnChangeJobMtl. I can get a box to pop up but I can’t get the lot number to fill in.
Help :slight_smile:

for each Part no-lock where Part.PartNum = ttnonconf.partnum ,
each PartTran no-lock where (Part.Company = PartTran.Company and Part.PartNum = PartTran.PartNum )
and PartTran.TranType = ‘STK-MTL’ And PartTran.JobNum = ttnonconf.JobNum.

Assign ttnonconf.LotNum = parttran.LotNum.