Sales Order Need By Date - Setting Programmatically

Let’s say I have a customer with a standard lead time of 30 days. Can I have Epicor auto-fill the need by date on sales orders entered for this customer based on that lead time, or is something like that only achievable VIA BPM?

Yeah, you’d set this via BPM. I mean, that is the layer for managing your business logic. I don’t think you’d need custom code though. Just do a look up on the customer and use that data to set your custom field.

Thanks. I was hoping there was an out of the box way to set this.

Assuming that you’re using DemandAddLeadTime
Create a new BPM on Erp.BO.SalesOrder.ChangeCustomer
Type: Post-Processing

Create new variable - I called mine leadDays as a int

Drag out variable creation and set it to leadDays

Expression:

Db.Customer.Where( r =>r.Company == callContextClient.CurrentCompany && r.CustNum == dsOrderHedRow.CustNum).Select( r =>r.DemandAddLeadTime).DefaultIfEmpty(0).FirstOrDefault()

Now drag out, set field…

The field you want to update… ds.OrderHed.NeedByDate

Expression:

DateTime.Today.AddDays(Convert.ToDouble(leadDays))

This gives you a starting point… :slight_smile: