I am attempting to modify a customization that was created before my time with my company. This customization does work in its current context. It was designed to set the PayFlag under Order Entry > Header Tab > Header Manifest Billing Tab > Billing tab to “TP” for Third Party when the customer number in the list of hardcoded customer numbers in the customization is set. The issue I am having is that we are now utilizing EDI and when Sales Orders are created via EDI, this customization does not set the PayFlag. I have been trying to rework it via a BPM, Data Directive, or modifying the customization with no luck so far.
I am open to any options, we just need this automation to be in place to save us from having to modify a lot of orders that EDI creates. Does anyone have any insight on how to do this? I am not a very experienced customization developer so my knowledge is limited. This customization fires off as soon as I enter the CustID in the SoldTo box in Sales Order Entry and returns the message box saying “Third Party Has Been Set”
Here is the customization that is working when we manually create Sales Orders:
This is why the recommendation is to use BPMs instead of screen customizations. In fact, this won’t work in the browser at all. There are a lot of examples of BPMs setting fields conditionally here on the site.
@jscheffler I would put this post processing on SalesOrder.ChangeCustomer for normal processing to future proof the sales order entry process.
EDI does as you have seen bypass all of the salesorder processing, so you will need the same ish routine on DemandImportEntry.ImportProcessingDemand. This is the header section of my routine which is based on the thread below.
/* transfer from demand to order */
var DemandHeadRow =
(from row in Db.DemandHead.With(LockHint.NoLock)
where
row.SysRowID == DemandHeadRowid
&& row.EDIOrder == true
select row
).FirstOrDefault();
if (DemandHeadRow != null)
{
/* Copy cust profile to sales order */
var orderHedRow = Db.OrderHed.Where(oh => oh.Company == DemandHeadRow.Company && oh.OrderNum == DemandHeadRow.OrderNum ).FirstOrDefault();
{
using (System.Transactions.TransactionScope txScope = IceDataContext.CreateDefaultTransactionScope())//start the transaction
{
var Customer = Db.Customer.Where(Customer_Row => orderHedRow.CustNum == Customer_Row.CustNum && orderHedRow.Company == Customer_Row.Company).FirstOrDefault();
{
var shiptoRow = Db.ShipToMFBill.Where(st => st.Company == Session.CompanyID && st.CustNum == Customer.CustNum && st.ShipToNum == orderHedRow.ShipToNum).Select(st => new { st.PayBTFlag, st.PayAccount}).FirstOrDefault();
if (shiptoRow != null)
{
orderHedRow.PayFlag = shiptoRow.PayBTFlag;
orderHedRow.PayAccount = shiptoRow.PayAccount;
Ice.Diagnostics.Log.WriteEntry($" custID {Customer.CustID} PayAccount {orderHedRow.PayAccount}");
}
}
txScope.Complete();//commit the transaction
}
}
}
I followed your setup for a Method Directive on SalesOrder.Update. I receive this error. In my query ttOrderHed and customer are linked by CustNum. 3P is the name of the Method Directive I created.