Validation rule in Opportunity Revenue Displays Error For All Cases
We are writing a validation rule to indicate that Quantity cannot be in decimal and Unit Price cannot be below Zero while adding a product. The script is written in Opportunity Revenue Object but the validation is shown for all positive scenarios too (Even if Price is above 0 and quantity is not decimal)
Steps to reproduce:
App Composer -> Opportunity Revenue Object -> Server scripts -> Validation rules -> Object Rules.
Groovy script written:
def regexQty = /^[0-9]*$/
if (!Quantity.toString().matches(regexQty))
{
return false;
}
if (UnitPrice<0)
{
return false;
}
return true
Tagged:
0