Update UD field on JobHead when JobEntry DeleteAll method is used

Im trying to set a ud field on jobhead as False when someone does a DeleteAll on a job. Trace log shows the method is being called. so i set up a method directive on that BO and method.
tracePacket>
businessObject Erp.Proxy.BO.JobEntryImpl businessObject
methodName DeleteAll methodName

I have tried with conditions and without. I am using the Set Fields Widget.
What am i doing wrong?
i cant get this to work.

you’ve attempted this on pre-processing yes?

yes. both pre and post.

I think the issue is you are setting that value on the “ttJobHead” which is a temp table that does not get updated in that context. Probably a set by query would give you the ability to write direct to Job table perhaps. Worst case, we can do this with a few lines of code too.

The ttJobHead doesnt have my Ud field. so my Query is ttjobhead. jobnum = jobhead.jobnum
and when do try to select the specified field my UD field isnt in there. How do i get this to show? or am i going about it all wrong?

1 Like

For sake of getting you a solution, try this code:

foreach(var ttJob in ttJobHead)
{
 var job = Db.JobHead.Where(j => j.JobNum == ttJob.JobNum && j.Company == 
 ttJob.Company).FirstOrDefault();
 if(job != null)
 {
  job.Consolidated_c = false;
 }

}


Db.Validate();

Warning - I am only suggesting we manually modify the field because A) Your solution was already looking to do so B) It is a UD field which should not be bound by any BO logic.

1 Like

thank you. that works.

1 Like