Filed Update event handler issue

  • 11 July 2023
  • 1 reply

Userlevel 3


I need to add new field name as ‘Claim Percentage’ into sales order invoice screen. And when the claim Percentage is entered Invoice Amount need to be calculated like below formula.

amount = unit price * qty * (claim Percentage/100)

I have add fieldUpdated event into SOInvoiceEntry screen.

 protected void ARTran_UsrClaimPercentage_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)

var row = (ARTran)e.Row;
ARTranExt detail = PXCache<ARTran>.GetExtension<ARTranExt>(row);
decimal? val1 =detail.UsrClaimPercentage/100;
decimal? val = row.CuryTranAmt*val1;
row.CuryTranAmt = val;
// cache.SetValueExt<ARTran.curyTranAmt>(row, val);


When adding the claim Percentage at 1st time formula is working properly.But, after that when changing the same field Amount calculation is wrong.

  • 1st change
  • 2nd change for same row same field.Amount need to 25


Why This is happened?



Best answer by Naveen Boga 11 July 2023, 10:32

View original

1 reply

Userlevel 7
Badge +18

@jeewanishalika20  CuryTranAmt is a calculated field that relies on the Ext Price field and various Discount-related fields at the line level.

When your custom logic attempts to modify the value upon updating the custom field UsrClaimPercentage, subsequent events are triggered, resulting in updates to the Amount field.


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved