Is there a way to force a quantity more than 0 on a SO line?
This is more of a quality check for Customer Service during the order entry process.
Is there a way to force a quantity more than 0 on a SO line?
This is more of a quality check for Customer Service during the order entry process.
Hi
We can do below two options.
OPTION 1
It requires a small piece of customization. Please find the code for reference.
public class SOOrderEntryEXT : PXGraphExtension<SOOrderEntry>
{
protected virtual void SOLine_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
{
SOLine row = (SOLine)e.Row;
if (row != null)
{
if (row.OrderQty == decimal.Zero)
{
sender.RaiseExceptionHandling<SOLine.orderQty>(row, row.OrderQty, new PXSetPropertyException("Quantity must be greater than 0", PXErrorLevel.Error));
}
}
}
}
OPTION 2
protected virtual void SOLine_OrderQty_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e, PXFieldDefaulting baseEvent)
{
baseEvent?.Invoke(sender, e);
SOLine row = e.Row as SOLine;
if (row == null) return;
if (row.OrderQty == decimal.Zero)
{
e.NewValue = row.OrderQty = 1;
}
}
Hope this helps!!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.