Enabling Upload from Excel for the Grid

Hi All,

Today I want to share with you a way how to enable upload form excel for custom grid.

Actually this is quite simple –

Step 1 – define PXImportAttribute on data the data view under the grid.

public class CSCalendarMaint : PXGraph<CSCalendarMaint, CSCalendar>
       public PXSelect<CSCalendarExceptions> CSCalendarExceptions;

Step 2 – enable appropriate Grid Mode (Allow Upload) on the grid properties.

enable appropriate Grid Mode acumatica

This will enable upload button on the grid action bar with standard functionality.

In some cases, you may want to have more control on the import process. In this case you also may implement optional interface: IPXPrepareItems. This interface should be implemented on processing graph itself.

public interface IPXPrepareItems
       bool PrepareImportRow(string viewName, IDictionary keys, IDictionary values);
       void PrepareItems(string viewName, IEnumerable items);
       bool RowImported(string viewName, object row, object oldRow);
       bool RowImporting(string viewName, object row);
  • PrepareImportRow – This event will be triggered right before insert record to cache. You can review keys and values that will be assigned to new record.
  • PrepareItems – Used to review items before import, but right now does not execute for performance optimizations.
  • RowImporting – This and next events will be executed only if you decided bypass update of existing records. On that event you can decide what to do with existing record if it was in the database before, for example delete it.
  • RowImported –  Here you can control update operation after insert.

Unfortunately right now there is an issues with declaring PXImport attribute on extension, but this thing will be fixed soon and you will have a easy way to import everything instead of typing.

Have a nice development!

1 Reply to “Enabling Upload from Excel for the Grid”

  1. Hi Sergey,

    I tried doing so on processing screens (Release Production Orders, Sales Prices, Vendor Prices, etc.) but it doesn’t seem to work. Anything else I need to tweak in order to make the import button works on processing screens?

Leave a Reply

Your email address will not be published. Required fields are marked *