Hello,
In various parts of the Acumatica source code I’m finding code similar to this.
public void RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
{
//some code
if (sender.RaiseExceptionHandling(_FieldName, e.Row, sender.GetValue(e.Row,_FieldName), new PXSetPropertyKeepPreviousException(Messages.errorMainWarehouse)))
{
throw new PXRowPersistingException(_FieldName, null, Messages.errorMainWarehouse2);
}
//more code
}
Does anyone know what this code is doing?
My theory was that
“if (sender.RaiseExceptionHandling(_FieldName, e.Row, sender.GetValue(e.Row,_FieldName), new PXSetPropertyKeepPreviousException(Messages.errorMainWarehouse)))”
is checking to see if “RaiseExceptionHandling” has already been called against e.Row for _FieldName. I think it is specifically checking to see if Message.errorMainWarehouse was raised previously. If the RaiseExceptionHandling method returns True then we get to the PXRowPersistingException and an error is displayed on save.
I think that “new PXSetPropertyKeepPreviousException” sounds like it should allow you to set a field value without clearing the current exception.
The problem is that when I try to use this set up I cannot get the if(sender.RaiseExceptionHandling.. method to return true, so perhaps I’m misunderstanding why an “if” statement would be used with sender.RaiseExceptionHandling
Thanks
Steve