Create a method directive that all jobs for a specific customer JobHead.SchedCode as Rush

I am trying to create a method directive and have hit a wall.
Currently, all of our jobs use (JobHead.SchedCode) Normal.
From a drop down list, the order entry team has to remember to change this to RUSH on a specific customer.
I have been asked to automate this.
My thought was a method directive, but I can not get the customer # from the OrderHed and the JobHead to work together.
I am relativiely new to BPMs and thought maybe I could get some direction or adivce from this group.

Hello Vicki,

The first question is: are your orders make direct? If jobs are made to stock, it is very difficult to connect jobs to orders unless that part is only sold to that customer.

No, they are make to order

Great. JobProd is the table that links your orders to jobs.

Mark, thank you for your response.
How would i go about creating this?
I tried creating the method directive. Although I have created simple BPMs I have not tired to link two tables to update a filed automatically.

What I would do personally, is write a BAQ to learn the linkage. Create a parameter that inputs a job and then returns the field in the customer table that indicates this should be a RUSH order. Something like this:

image

Play around with it. Make sure it returns only one record for each job. I’m not sure if you would ever use one job with multiple Make-To-Order records, but if you do, then you’ll have some tweaking to do.

If you run Custom Code, convert the BAQ SQL to a LINQ statement. Not tested, but probably something like this:

from Erp.JobProd as JobProd
inner join Erp.OrderHed as OrderHed on 
	JobProd.Company = OrderHed.Company
	and JobProd.OrderNum = OrderHed.OrderNum
inner join Erp.Customer as Customer on 
	OrderHed.Company = Customer.Company
	and OrderHed.BTCustNum = Customer.CustNum

I used LinqPad to convert the BAQs SQL to LINQ.

I have tired of trying to link two tables together. :rofl: There are others on the list who are far better than I am and do LINQ all the time.

Take the result and set your JobHead.SchedCode accordingly.

If you use an In-Transaction Directive, then you must use a Custom Code widget. If you use a Method Directive (Preprocess on the Update method for example) then you can either call the BAQ directly using the Invoke BO Method or you can also use the custom code widget.

1 Like

:exploding_head:
thank you for that

Thank @hkeric.wci. He’s the first to bring LinqPad to this forum if I recall correctly.

Thank you, I enjoyed the laugh today! I will test this one out.