BPM to Pull data from Customer to OrderHed

,

Hi,

What is the best way to do this? I was thinking a BPM on GetNewOrderHed to pull the data from the customer table which has the default information and set a field in OrderHed.

Customer_UD.Supplier_c > OrderHed_UD.Supplier_c

I tired putting together a BPM but I kept getting compile errors.

Any one able to help me with this annoying little one! It’s a Combobox on the customer entry with three selections in there, I just want it to change based on the default one in the combobox for that order but the end-user is allowed to update the field on the Order Entry and it doesn’t change the Customer Table.

I hope that makes sense.

Kind regards,
Aaron.

Hi @aarong
To do this via BPM you will want to first create a new Post Processing on SalesOrder.ChangeCustomer
This is called on New, and change

Add a Custom code widget into the BPM, then paste the code below.
Enable the directive, then load a new sales order record.
Your record should pull through. You will need to alter if the field names are different from the above.
////////////////////////////////////////////////////////////////////////////////////////////////
//BPM by Joe Davies
//OrderHed to Customer

Erp.Tables.Customer Customer;
var OrdHed = (from r in ttOrderHed where r.Added() || r.Updated()
select r).FirstOrDefault();

if (OrdHed != null)
{
var Cust = (from c in Db.Customer
where c.Company == Session.CompanyID && c.CustNum == OrdHed.CustNum
select c).FirstOrDefault();
{
OrderHed.Supplier_c = Cust.Supplier_c;
}
}

///////////////////////////////////////////////////////////////////////////////////////////////////
Thanks - Joe

1 Like

I resolved by using a set field widget on a Data Directive but this method seems good also.

Glad it’s working :slight_smile:

1 Like