Hello,
I have created a custom grid which stores a list of warehouses. I have a requirement to perform a couple of checks.
1. The warehouse in the list cannot be the same as the selected warehouse.
2. A warehouse shouldn’t be entered into the list twice.

I’ve added these checks onto the RowSelected event, everything appears to work fine, the red cross appears on the row with the problem and on the tab. I’ve used this code to raise the error:
e.Cache.RaiseExceptionHandling<PinnSitePriority.prioritySiteID>(e.Row, inSite.SiteCD, new PXSetPropertyException(errDuplicateWarehouse, PXErrorLevel.RowError));
When I click the Save button I see the following:

This is exactly what I want.

However, if I click into another row and the editing icon appears and then I click on the Save button...

Acumatica doesn’t display the message - it ignores the errors reported on the grid and Saves the data, the Save button become disabled.
Can anyone explain what is happening? I had expected that saving would not be possible if errors had been raised in a cached object but this doesn’t seem to be the case.
I cannot find much explaining error trapping and handling in the documentation - I’ve seen info about getting the errors to appear but not how to stop the Save button from ignoring the errors. I’ve also seen other threads which ask similar questions to this and one of them suggested adding code to the RowPersisting event. In my case I would like to use the RowSelected event to report the error and it would be a shame if the code had to be repeated in the RowPersisting event. I’ve also tried using RowSelecting and RowSelected to report errors but I still have the same issue when the Save button ignores the errors.
Should Acumatica be ignoring the errors I’ve raised? Am I raising errors in the correct way, at the correct time? Does anyone know how I can work around this issue?
Thanks
Steve