Loading ...

Validating XML and Excel Imports in Acumatica

If you need to allow users to upload records from an XML or Excel file directly into a grid, Acumatica makes the initial setup incredibly easy. You simply decorate your data view with the [PXImport] attribute and ensure your grid allows editing.

In a classic ASPX screen, enabling this looks like setting AllowEdit="True" on your PXGrid control. Once configured, the standard "Load Records from File" button automatically appears on your grid toolbar.

But here is the catch: what if you need to strictly validate or manipulate that data before it hits the database?

Because that upload button is deeply integrated into the framework's import engine, it is not a standard PXAction that you can easily override with a custom delegate. You cannot just intercept the button click to inject your validation logic.

The Solution: Hooking into the Cache via RowInserting

Instead of fighting the UI button, you let the import framework do its job of parsing the file, and you intercept the data as it hits the PXCache.

When the import engine processes the uploaded file, it pushes the parsed records into the cache one by one. This reliably triggers the RowInserting event for each record. By hooking into this event, you can validate, modify, or reject the incoming data before it is ever persisted.

Here is a clean approach to handling this in your graph:

Be the first to rate this post

  • Currently 0.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5