Skip to main content

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?

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.


@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?​​​​​


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.

 


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


Reply