Solved

Field updated event not working as expected

  • 7 June 2023
  • 1 reply
  • 109 views

Userlevel 3
Badge

Hi all,

I have a field updated event for soorder invoices screen Artran qty field which is used to get line weight by multiplying item weight and qty as below.

public PXSelect<InventoryItem> dataview; 

protected void ARTran_Qty_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{

var row = (ARTran)e.Row;
ARTranExt detail = PXCache<ARTran>.GetExtension<ARTranExt>(row);
foreach (PXResult<InventoryItem> result in dataview.Select()){

InventoryItem item = result;
if(item.InventoryID == row.InventoryID) {

detail.UsrItemWeight = item.BaseItemWeight;


decimal? LineWeight = row.Qty * detail.UsrItemWeight;
detail.UsrLineWeight = LineWeight;
}


}

}

usrLineweight is the custom field for Line Weight in details level of invoices screen. The line weight should be calculated just after qty field is updated. But it’s only working in the time when adding a new row. How can I solve this issue?

Thank you.

icon

Best answer by sweta68 7 June 2023, 14:14

View original

1 reply

Userlevel 7
Badge +10

Hi @oshadarodrigo64 

Could you please replace

detail.UsrLineWeight = LineWeight;

line with 

cache.SetValueExt<ARTranExt.usrLineWeight>(row, LineWeight);

instead of setting the detail.UsrLineWeight field directly, use the cache.SetValueExt method to update the field value.

Hope, It works!

Regards,

Sweta

Reply


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