I set a boolean to true if my condition is met in the RowPersisting handler on SOOrder. It loops through the lines and finds if there is a row where discount amount = 0.
I do not want to prevent the record from being saved. I just want a popup to display warning them there is a row with a zero discount.
In the SOOrder rowpersisted, I have a check to see if the warning is true.
protected virtual void _(Events.RowPersisted<CRQuote> e)
{
var row = (CRQuote)e.Row;
if (row == null) return;
if (e.TranStatus == PXTranStatus.Completed)
{
if (showWarning)
{
}
}
}I don’t can’t throw any exceptions or it will prevent the record from being saved. I also cannot use a “.Ask” popup as it causes the event to fire again and causes an error that the record was already modified.
Also, I don’t want to display any messages in rowselected. I just want this to be verified when they are saving the record.
I tried this because it says WithWarning, but it prevents saving the record.
throw new PXOperationCompletedWithWarningException(ICSMessages.MissingPriceOrDiscount, PXErrorLevel.Warning);
How can I just put a message box on the screen without throwing an exception?
RaiseExceptionHandling does not show a dialog on the screen.
My last ditch effort might be to put a string field on the screen and hide it unless the warning condition exists, but that seems like a lot of churn to just show a message box.
This seems like it should be a no-brainer.