Hi guys I’m new to Epicor and trying to work on something. I have created a new field (PCC_c) on Customer and OrderHed, I’m having hard time how to make the field from Customer.PCC_c to reflect same on OrderHed.PCC_c
I tried doing it to by Directive Maintenance and I’m kinda lost. I need any guidance from the group. Any help much appreciated. Thank you
My typical way to handle something like that is to create a PreProcessing method directive on Customer.Update that checks whether or not PCC_c changed, and if so, set a flag.
Then in a PostProcessing method directive on Customer.Update, check to see if that flag is set, and if so, go update the order.
Okay, this part is for the new orders:
when in order entry, depending in which version of the software you are, either use the tracing option or if Kinetic, the browser built in developer tools to figure out which method is being called when you select a customer on your order header. Once you know that you can add a post process method directive that adds the value from your customer record to your order head record.
For me it looks something like this:
‘OrderHedRow’ does not contain a definition for ‘PCC_c’ and no accessible extension method ‘PCC_c’ accepting a first argument of type ‘OrderHedRow’ could be found (are you missing a using directive or an assembly reference?)
For the other part where you update the customer information and need to pass that to any open order, you need to follow the principle suggested already here by Marjorie, first do a preprocess directive on the customer update where you check in a condition if the PCC_c value has been changed from any to any => enable post process directive. In the post process directive, create a condition that checks if it has been enabled from the correct preprocess directive, on true add a C# custom code widget and add following code:
// custom code created by Sam (sam@sam.com) [09/26/2025]
using (var tx = IceDataContext.CreateDefaultTransactionScope())
{
foreach (var c in ds.Customer.Where(r => r.RowMod == “U”))
{
var comp = c.Company; var cust = c.CustNum;
bool pcc = Convert.ToBoolean(c[“PCC_c”] ?? false);
foreach (var oh in Db.OrderHed.Where(o => o.Company == comp && o.CustNum == cust && o.OpenOrder))
if (((oh["PCC_c"] as bool?) ?? false) != pcc) oh["PCC_c"] = pcc;
In the second case, I just want to point out that you are allowed to use this type of code with direct database update only when you are updating your own custom fields, should you use it to update any native Kinetic fields you would risk going around the Business Object logic and might end up with corrupted data in your database, just something to bear in mind.