I don’t want user to save the record if there is any error, I wrote a custom fieldverifying event for the RQRequestLine and it works fine when the values is selected however, it allows user to save the record event if there is rowpersisting event written that calls fieldVerifying event.
protected void RQRequestLine_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
{
var row = (RQRequestLine)e.Row;
if (row != null)
{
object newValue = row.ExpenseAcctID;
this.Base.Lines.Cache.RaiseFieldVerifying<RQRequestLine.expenseAcctID>(row, ref newValue);
}
}
protected void RQRequestLine_ExpenseAcctID_FieldVerifying(PXCache cache, PXFieldVerifyingEventArgs e)
{
// logic
cache.RaiseExceptionHandling<RQRequestLine.expenseAcctID>(row, Act?.AccountCD,
new PXSetPropertyException(Messages.Test, PXErrorLevel.Error, row.ExpenseAcctID));
}