I am having some difficulty surrounding checking the “Counter Sale” check box on Sales Order Entry. I have created a Method Directive BPM that sets CounterSale = True when a particular customer is set within the order header.
I note that when the check box is ticked via the UI the tabs for Lines and Releases is removed from the UI, when the check box is ticked via the BPM using “Set Field” the tabs remain.
Having completed a trace it appears that the business object that is called via the GUI is SalesOrderImpl.ChangeCounterSale.
Could anyone point me in the direction of how to invoke this routine to resolve my problem?
That might be too early.
I recommend that you disable your BPM and then run a trace of the following:
Create Sales Order
Enable the counter Sale checkbox.
Don’t save in between.
See what Methods are being called… I suspect that the Order Number first needs to exist before the Counter Sale value can be set, so what you might see in the trace is that SalesOrder.Update or MasterUpdate is called before the SalesOrder.ChangeCounterSale is called. If that is the case then you will need your BPM to be on the Update or MasterUpdate, with a criteria of 'when CustomerNum is changed from Any to Another.
I did a quick test of just updating the Countersale field in a BPM, and it does show on the form. But the changes to the form (Hiding the Line and Release tabs), don’t take place. But upon refreshing the form, those two tabs do indeed become hidden. So this might require a UI customization to hide/show those tabs, on a change of the CounterSale checkbox state.