Data Import Addon: Abort import if mandatory field is null

Using the Data Import Addon, how do I make the upload wizard abort import when a mandatory field is null?

For example, in an Excel with columns ID*, Name*, Birthday
the import should be aborted if in any of the rows the value for ID and/or Name is unavailable.

Hi,

You can put all rows into one transaction: GitHub - mariodavid/cuba-component-data-import: CUBA component for easy data import

If an error occurs there, nothing will be imported. Is this what you mean?

Cheers
Mario

Hi @mario the template is already set to Single Transaction.

image

Based on the example above, I want the import to be aborted because row 2 is missing Name and row 3 is missing ID. However, as of now the file will continue to import successfully.

Hi @mario I tried adding this to the Pre-commit script
if(entity.uid.isBlank() || entity.name.isBlank()){ return false; }

Now the row with missing ID or Name will not be imported, whereas the row with no missing ID and Name gets imported. Any way to abort the import instead?