Skip to main content

Most screens with grids have an option to import from an excel file.  Specifically I am talking about the SO entry screen below 

I have a customization where I customized and added an event handler on this screen and it fires fine when users are entering data in the grid.  But when they load records form file, it doesn’t handle.  Never fires the event from what I can tell.  I stripped it bare to see if the code was having an issue, but even the simplist code never fires as below:  

protected void SOLine_RowUpdating(PXCache cache, PXRowUpdatingEventArgs e)
{

    var row = (SOLine)e.NewRow;

}

But the same event fires when modifying the data in the screen. 

Any thoughts? 

 

The PXRowUpdating event might not be the right place for import scenarios. Try using the PXRowPersisting or PXRowPersisted events instead. These events are more reliable for handling data during batch operations like imports.


Its not about reliability, Its just not calling them, ever lol.  I didn’t try rowpersisting/persisted.  I’ll give it a try.  Thanks


RowPersisting and Persisted are not firing either

Row level seem not to be firing.  

Field level are.  I tried verifying and others. 

 


When using screen entry  both the insert and the update events would fire when adding a new record.  I did the validation in the update event on the row because I was assured to have the data there I was looking for. in the insert it wasn’t there but alway in the subsequent update it was there.   This is SOLine and the inventoryid btw. 

But when importing all fields are set at the same time.  Only the insert is called.  There is no update.   Its just depending on how data is going in (data entry, or import process like populate from file) affects the events called. 

I just need to cover both updates and inserts so that imports and screen mods are covered.  Thanks for the input Yurly. 


@edwardmcgovern53 If you load from Excel using standard Acumatica feature, you can control the process if you implement IPXPrepareItems interface. The methods provided by the interface allow you to change mapping, validate records, etc. In your case - you can also fire you additional logic from them.


I did not know that.  It would be nice to handle the problem instead of adding new event handlers.  I will check that out 


Reply