I have a requirement where the input year should not be greater than the current year. This validation has to be given to the field... (using Integer input field)
Well no such out of the box function present in Pega
.
You need to write it on your own.
If you are looking for Edit Validate
rule then you can write an edit validate rule with below code.
if (theValue.trim().length() == 0) {
return false;
}
// theValue is by default the value present on the field. Its String by default.
int year = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR); // get the current year value.
if (Integer.parseInt(theValue) < year){ //convert theValue to int and check if it is less than the current year.
return true;
}
else {
return false;
}
You can write a java function
also and call it in Obj Validate
rule. If you want to chose the java function
option instead of edit validate
then that function should accept theValue
as parameter.