Solved

value can not be null parameter name key

  • 30 April 2023
  • 2 replies
  • 390 views

Userlevel 3
Badge

Hi,

I create a new data field into my purchase order screen poline DAC,

[PXDBString(10)]
[PXUIField(DisplayName="uomnew")]

Then I try to set field value in rowselected event.

 public class POOrderEntry_Extension : PXGraphExtension<PX.Objects.PO.POOrderEntry>
  {
    #region Event Handlers

    protected void POLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
    {
      
      var row = (POLine)e.Row;
      POLineExt poLine = PXCache<POLine>.
           GetExtension<POLineExt>(row);
      poLine.Usruomnew= "news";
     if(poLine != null){
       poLine.Usruomnew= "new";
     }
      
    }

    

    #endregion
  }

 

After adding POOrderEntry_Extension and published It shows an error below like that.

Can you please give solution for that.

icon

Best answer by Naveen Boga 1 May 2023, 05:42

View original

2 replies

Userlevel 7
Badge +17

Hi @jeewanishalika20  It is NOT recommended to assign the value in the Row_Selected event.

Please move it a proper event.

In the above code, there are no NULL checks hence you're getting this issue. I have modified your code and below is the working code.

 

    public class POOrderEntry_Extension : PXGraphExtension<PX.Objects.PO.POOrderEntry>
{
protected void POLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
var row = (POLine)e.Row;
if (row != null)
{
POLineExt rowExt = row.GetExtension<POLineExt>();
if (rowExt != null)
{
rowExt.Usruomnew = "news";
}
}
}
}

 

Userlevel 3
Badge

Hi @naveen,

 

Thanks it’s working.

Regards

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