Solved

Code performance optimizing, move event in SOline_rowselected to?

  • 29 March 2022
  • 4 replies
  • 70 views

Userlevel 6
Badge +5

Hello,

     We are having some legacy codes like below (with some modifications to make it look short):

 protected void SOLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{

SOLine soLine = (SOLine)e.Row;
if (soLine != null)
{

PXUIFieldAttribute.SetEnabled<SOLineExt.usrEstWgt>(cache, soLine, false);

InventoryItem item = PXSelect<InventoryItem,
Where<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>>
.Select(Base, soLine.InventoryID);
if (item != null)
{
InventoryItemExt rowExt = PXCache<InventoryItem>.GetExtension<InventoryItemExt>(item);
SOLineExt soLineExt = PXCache<SOLine>.GetExtension<SOLineExt>(soLine);
cache.SetValue<SOLineExt.usrBrand>(soLine, rowExt.UsrBrand);
cache.SetValue<SOLineExt.usrPackSize>(soLine, rowExt.UsrPackSize);
}

}
}

 

            It is not perfect, but can run without error.

However, recently, after upgrading to 2021R2, user are complaining the SO entry becomes slow with more than 10 lines on.

 

            It probably  Caused by the soline_rowselected event. But if I would like to rewrite. What is the best event place I move the codes to?

icon

Best answer by Naveen Boga 29 March 2022, 07:30

View original

4 replies

Userlevel 7
Badge +17

Hi @ray20  Yes, we should not assign the values in the Row selected event, it will slow down the performance.

 

You can remove the code from the Rowselected event except enable code and move it to InventoryID_FieldUpdated event.

Let me know code if any code samples required.

Userlevel 6
Badge +5

@Naveen Boga Thank you ,code master.
Do we know whether it is possible to disable the soline extension fields without writing codes?

If I remain the enable and disable codes in rowselected, would it still effect on the performance?​​​​​

Userlevel 7
Badge +17

Hi @ray20  Yes, we can disable the field without code as well.


We can achieve this from the Automation steps in the customization package. Please find the screenshot for disabling the field.

 

Userlevel 6
Badge +5

@Naveen Boga  Thank you ,code master.
I will have a try later.

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