Skip to main content
Question

Trying to cancel the events that are triggered when you change the Ship Via on Sales Orders

  • May 19, 2026
  • 2 replies
  • 41 views

Joe Schmucker
Captain II
Forum|alt.badge.img+3

If you have a ship via with no cost associated with it and select it, it fills the Freight Cost field in the Totals Tab with zero.  I can enter a value and save it and all is well.  

After entering my desired amount and select a different Ship Via that doesn’t have a cost associated with it, it changes the cost to zero, and I don’t want to overwrite the Freight Cost I entered.

I THINK that if I can override the events on the Ship Via to NOT update ANYTHING unless the Ship Via has a cost setup on it, OR it is a connected service, that might do what I need.

Is this what I should do to try to cancel the update event for Ship Via?  If so, what code do I put in that will “cancel” the update event?

		}
protected virtual void SOOrder_ShipVia_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated InvokeBaseHandler)
{
if (InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (SOOrder)e.Row;

Carrier carrier = SelectFrom<Carrier>.Where<Carrier.carrierID.IsEqual<@P.AsString>>.View.Select(Base, row.ShipVia);
if (carrier != null && (carrier.IsExternal == true || carrier.CalcMethod == "P"))
{
//DO WHATEVER ACUMATICA WANTS TO DO
}
else
{
//CANCEL WHATEVER ACUMATICA IS DOING
}
}

 

2 replies

Joe Schmucker
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • May 20, 2026

Follow up.  I haven’t received any responses, and after debugging and doing further testing, I don’t think the freight cost is being set within the Ship Via event anyway.

I ended up writing code in other event handlers to manage the values in the freight cost field, then using the solution in the topic below to recalculate the document totals after hacking the freight cost amount.

The code I used to hack the freight cost field isn’t really pertinent to my original question, so I’m not providing any of that.  

Unless anyone wants to contribute, I’m confident that there is no solution to my original request.  Even if I could “cancel” the work done by Acumatica in that event handler, the freight cost and document totals are handled in other methods.


VardanV
Varsity I
Forum|alt.badge.img+1
  • Varsity I
  • May 21, 2026

Hi Joe,

If you need to restrict the Freight Cost value from being reset only when the Ship Via value is updated, I believe you will need to completely override the SOOrder_RowUpdated event handler, since the Freight Cost is being reset to 0 in that event when the ShipVia field changes.

From my review, the Freight Cost value is generally being reset in the following three places in the code:

  • Events.FieldUpdated<SOOrder.shipVia> event handler in the SPCheckoutMaintExt extension
  • SetFreightCost(decimal baseCost) method in the SOOrderEntry graph
  • SOOrder_RowUpdated event handler in the SOOrderEntry graph

You can try overriding or replacing these sections of code depending on your specific requirements.