As the title says, I’m looking for guidance for the best way to prevent new Sales Orders from being created for any Customer that doesn’t have a Primary Billing Contact selected. I ran a trace in Order Entry on simply entering a CustID and hitting ‘TAB’, and the results were confusing enough that I don’t understand how to begin. That’s with System Monitor closed and the New Order created before starting the trace.
I assume a BPM will have to look at the “Bill To Customer” in OrderHed and then loop through all the Contacts associated with that CustNum to see if any of them are marked as PrimBCon, but the code to do that is beyond me. I’m also not sure which Method to even use for the BPM.
I don’t block the order from being created but have a BPM that provides a warning when an order is saved and there is no Primary Billing Contact or the PBC doesn’t have a valid e-mail address.
The BPM is Post-Processing on SalesOrder.Update. There are only 2 widgets required
If the for Primary Billing Contact doesn’t return 1 or more rows, the message is displayed. The criteria on my CustCnt table is a rudimentary check for a valild e-mail address since I wanted my check to alert for either a missing Primary Billing Contact or a missing e-mail address for the contact.
While not required, I also added a condition widget to limit who gets nagged by this message.
Oh, this sounds like an excellent and much less complicated solution than my brain was reaching for. Thank you for providing those details. I’m off to try this night now…
This certainly seems like the right way to do things, but I’m wondering if you had to work through a couple of the wrinkles I’m experiencing before yours worked.
I setup the simple version in our Test environment with both True and False messages on the condition widget. I made it a Pre-Processing Directive because ultimately I want to block the Order from being saved if the conditions aren’t met.
The query is basic right now, with no criteria. The join from OrderHed to Customer is BTCustNum = CustNum (along with Company), and the join from Customer to CustCnt is in this screenshot:
When I create a new sales Order using a Customer that I know has a Billing Contact, I get the True statement when I fill out the Header info and Save (as I should):
When I add a Line and Save again, the False message pops up:
This message should not pop up at all in this scenario and I can’t figure out why it would. Nothing about the Customer or Bill To changes when the Line is added, so I’m not sure why Saving again would change the result for the Condition Module.
I’ve had this in place for a while, so don’t recall anything particularly problematic about it.
I see a couple of differences that might be relevant. My join from OrderHed to ERP.Customer is on CustNum = CustNum. I don’t bring BTCustNum into the join.
For anyone following along, I can’t get this to work in our environment (10.2.700).
I’ve tried putting the Pre-processing method directive detailed above on the Update and the MasterUpdate process. In both instances, if I merely enter a customer, PONnum, due date, then save, the BPM works correctly. As soon as I add a PartNum to a line and save, the BPM throws a false positive (indicating the Customer doesn’t have a Billing Contact assigned). If I delete the line and save again, the BPM works correctly.
When I trace the process, it looks like the CustomerImpl business Object is called when I add the partnum to the line, but the trace data correctly identifies the company and custnum, so I still don’t understand how adding a partnum to the line changes the result of the BPM checking for a billing contact. Trace data below.
There are 3 cases when a SO is changed: header, lines and releases so I would try and narrow it down. Because you can’t add lines nor releases without a header, all you need to worry about in your case is the header. And I would add that you don’t need to worry when the header is updated or deleted, only when it’s added. Below is a SalesOrder.Update.Pre method BPM:
Thank you for the reply. The RowMod criteria on OrderHed seemed to be the missing piece here, as adding it eliminated the Exception being raised when a Line was added.
I can only get this BPM to work correctly using the OrderHed and Customer tables in the Condition widget query. If I do that with the simple goal of blocking Orders for Customers that have no PrimBCon assigned, all works as expected.
As soon as I add the CustCnt table to the query to try validating whether the PrimBCon’s EMailAddress field is populated, the BPM always blocks the ‘Save’ after a Line is added.
This happens even though the Header/Customer info has not been changed, the OrderHed criteria in the Condition query is RowMod = “A”, and the Customer passes all criteria.
If I remove the CustCnt table from the query (which is being used to validate whether the PrimBCon’s EMailAddress field is blank), the
Does anyone have any thoughts about what else is necessary to get this to work? It seems so very simple that I’m sure the answer must be as well.
Hmm… If you want to include the CustCnt table then you need to remove the condition PrimBCon=0 so you need to negate the entire condition. But then the BPM will fire for all the other events too (when you edit or delete).
Have a look at the one below - I’m sure it can be done better but my brain is in Friday mode already.