As you may have come across, in most of Aumatica screens when we change InventoryID, many other fields for the row get reset forcing user to re-enter the values that results in wasting time and frustration. We are experiencing this on our heavily used AP Bills and Purchase Order. As pilot I tried to fix POLine to restore the values entered by user when InventoryID is changed through RowUpdated event handler.
The code works and restores the value of intended fields (see partial code below) but the problem is the total fields of the header are not refreshed. For example if I have only one POLine, upon chaning the InventoryID, header is reset to zero but when the custom handler restores the POLine values, the header remains zero.
Can someone advise how I can refresh POOrder related totals when POLine value is updated in event handler of POLine?
protected void POLine_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated InvokeBaseHandler)
{
//InvokeBaseHandler?.Invoke(cache, e);
var newRow = e.Row as POLine;
var oldRow = e.OldRow as POLine;
if (newRow != null && oldRow != null)
{
if (newRow.InventoryID != oldRow.InventoryID)
{
if (oldRow.CuryLineAmt != decimal.Zero && newRow.CuryLineAmt == decimal.Zero)
{
newRow.CuryLineAmt = oldRow.CuryLineAmt;
newRow.CuryDiscAmt = oldRow.CuryDiscAmt;
newRow.CuryRetainageAmt = oldRow.CuryRetainageAmt;
}
}
}
}