Trap 'ChangeUnitPrice' method on BO.SalesOrder

Hello All,

I’m on E10.2.200.11 and I’m trying to intercept a price change on the SalesOrderEntry form and can’t for the life of me figure out how to grab it (UI Customization). I need to display a message to the user if a condition is met.

In a trace, I can see the Erp.Proxy.BO.SalesOrderImpl.ChangeUnitPrice method being called, but I can’t seem to access it via either the Before or After adapter method test.

		this.oTrans_ordAdapter = ((EpiBaseAdapter)(this.csm.TransAdaptersHT["oTrans_ordAdapter"]));
		this.oTrans_ordAdapter.AfterAdapterMethod += new AfterAdapterMethod(this.oTrans_ordAdapter_AfterAdapterMethod);

		this.OrderHed_Column.ColumnChanged += new DataColumnChangeEventHandler(this.OrderHed_AfterFieldChange);

		this.oTrans_ordAdapter.BeforeAdapterMethod += new BeforeAdapterMethod(this.oTrans_ordAdapter_BeforeAdapterMethod);
		// End Wizard Added Variable Initialization

I then follow with BOTH an ‘after’ and a ‘before’ method test. Here’s the ‘After’:

	private void oTrans_ordAdapter_AfterAdapterMethod(object sender, AfterAdapterMethodArgs args)
	{
		EpiMessageBox.Show(args.MethodName);
		switch (args.MethodName)
		{
			case "ChangeUnitPrice":
				MessageBox.Show("Unit price changed");
				break;

The case is never reached, and the EpiMessageBox never displays ‘ChangedUnitPrice’. I know that the action works - as the number changes on the form and the ‘qty available’ check (core Epicor) occurs. I can’t trap those either, othws I’d use that.

BUT… the trace does show a method being executed…

I just can’t figure it out.
If anyone has a thought on this, I’d certainly appreciate e-hearing it.

Have you thought of using the BO mentioned in the trace?

1 Like

Thanks Ken. This is in a customization, not a BPM.
If I were trying to accomplish 1 single thing, I’d use a BPM, but the overall customization has quite a bit of interactivity to it - so I’m using a UI customization.

Update… and yes, I am trying to trap that very same method, but as a function of the adapter which is initialized by the SalesOrder form. So this is a Form customization.

Needed to add a handler for the OrderDtl record via the Form Event Wizard.

public void InitializeCustomCode()
{
	this.OrderDtl_Column.ColumnChanged += new DataColumnChangeEventHandler(this.OrderDtl_AfterFieldChange);
	// End Wizard Added Variable Initialization

Then I can test the price field available to me…

private void OrderDtl_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
{
	MessageBox.Show("OrderDtl Field changed: " + args.Column.ColumnName);
	switch (args.Column.ColumnName)
	{
		case "DocDspUnitPrice":
			this.reconfirmReqd = true;
			MessageBox.Show("Unit price changed");
			break;
	}
}

I was trying to avoid having to add a BO reference to SalesOrder since it was already attached to the form. Apparently adding this handler gives me access to the methods of the various OrdDtl fields.