I am looking for a way to create a data directive or method in which a sales order is created, and a message pops up when there is more than one alternatve bill to available.
When a new sales order is created, the Bill To field is populated with a message “Same as Sold To” which is actually the OrderHed.CustNum. That message is the same whether there are alternative Bill To’s or not .
It’s hard for the user to know if a Bill To exists or not.
We are aware of the Default Bill To option on the customer record and we would be willing to use that in conjunction with the BPM.
Any suggestions on how to tackle this one?
In theory, I am thinking the logic should be if there are more than one alternate Bill To, then show the message.
I think using the Method that fires when you enter a customer number, you could do a post processing method directive. Then look at the Customer Record to see if there are multiple BillTos by referencing the CustBillTo table. If so, you could throw a message (or pass some info back to the form to highlight the field or something to that effect).
I think you need to do a little bit more to get what you’re after. My suspicion is that there is always going to be a value in the BTCustNum (or BTCustID) field. What you are going to need to do in the BPM that I mentioned above is lookup if there are multiple possible BTs using a query of the CustBillTo table where the CustNum = CustNum from the Order. Then set a callContextBpmData field like callContextBpmData.Checkbox01 to true if that condition is true. Then in your row rule, you will pick the callContextBpmData view and the CheckBox01 field and check to see if it’s true. Then have your row rule fire. Does that make sense? I’m not sure what the method is called but if you do a trace when you enter the Customer on an order, it will tell you the method to set your method directive on.
SalesOrder.ChangeCustomer Post-Processing, and do a query check in there for multiple bill to addresses in the table @dr_dan mentioned (CustBillTo?). Then pop up a message.
I like the row rule better myself, but it will require client code and might not translate well to the web.
(I’m pretty sure you can do it though)
I am making advances! I have it working one way, but not completely happy with the results yet. I think it might do for now, but will have to continue to make this work the right way.
On the customer record, I made one of the alternate Bill-To as the default. This way, when a sales order is created and the customer is pulled in, that Bill-To will be present. Because we are focusing on one customer right now, I can temporarily get away wtih hard-coding that BT Customer IN in - so that anytime that CUSTID pulls in, it will be highlighted yellow and of course, going to that BILL TO.
When the user changes it from that particular ID, then the highlight is taken off.
This is the code that is created:
// Description: AltBillTo
// **** begin autogenerated code ****
RuleAction warningOrderHed_BTCustID = RuleAction.AddControlSettings(this.oTrans, "OrderHed.BTCustID", SettingStyle.Warning);
RuleAction[] ruleActions = new RuleAction[] {
warningOrderHed_BTCustID};
// Create RowRule and add to the EpiDataView.
RowRule rrCreateRowRuleOrderHedCustomerBTNameEquals_ALLSTAR = new RowRule("OrderHed.BTCustID", RuleCondition.Equals, "1685", ruleActions);
((EpiDataView)(this.oTrans.EpiDataViews["OrderHed"])).AddRowRule(rrCreateRowRuleOrderHedCustomerBTNameEquals_1685);
// **** end autogenerated code ****
Any further suggestions? I think the above may be a short-term solution.
For fun, I went ahead and decided to change the code so that if the BT Customer ID doesn’t match Customer ID, then add a warning. However, ONE ALTERNATE BILL-TO has to be selected on the customer record.
This way, no matter which customer is selected, as long as there is a default BILL-To, the row rule will kick in.
// Description: AltBillTo
// **** begin autogenerated code ****
RuleAction warningOrderHed_BTCustID = RuleAction.AddControlSettings(this.oTrans, "OrderHed.BTCustID", SettingStyle.Warning);
RuleAction[] ruleActions = new RuleAction[] {
warningOrderHed_BTCustID};
// Create RowRule and add to the EpiDataView.
RowRule rrCreateRowRuleOrderHedBTCustIDNotEqual = new RowRule("OrderHed.BTCustID", RuleCondition.NotEqual, "OrderHed.CustomerCustID", ruleActions);
((EpiDataView)(this.oTrans.EpiDataViews["OrderHed"])).AddRowRule(rrCreateRowRuleOrderHedBTCustIDNotEqual);
// **** end autogenerated code ****