CreateJobFromPWB Custom Code

I need some help getting started with this one.

I want to create a Method Directive that sets a UD field with the time that the job was created. I’m guessing that it would be set at Erp.BO.PlanningWB.CreateJobFromPWB post-processing.

What I tried to do was start with

foreach (var row in ttJobHead.Where(r => r.Added())) 

But it doesn’t like ttJobHead I’m getting an error.
image

Can someone point me in the right direction?

I believe ds.JobHead is what you are looking for.

2 Likes

I’ve tried that and get an error.
image

Are you wanting this only on jobs from the planning work bench or on all jobs? PlanningWBTableset doesn’t have the dataset for Jobhead as it is probably calling jobentry.getanewjob and using that to create the job. Trace should show you this.

Personally, I would just add an in transaction data directive on jobhead and use a simple Set Field widget to set the field. It should work easier with less issues and be a quicker way to do it.