I’m working on a Workflow Form in SailPoint IdentityIQ where I need to validate two date fields — Start Date and End Date.
My requirement is:
-
If the user selects an End Date that is earlier than the Start Date, the form should not submit.
-
It should display a validation error message to the user.
Here’s a simplified version of my form:
<Form name="CSV Path Input Form" type="Workflow">
<Section name="Section 2">
<Field displayName="Start Date" name="startdate" required="true" type="date"/>
<Field displayName="End date" name="enddate" required="true" type="date">
<ValidationScript>
<Source>
import java.util.Date;
Date end = (Date) value;
Object startObj = form.getField("startdate").getValue();
Date start = null;
if (startObj instanceof Date) {
start = (Date) startObj;
}
if (start == null) {
errors.put("enddate", "Please select Start Date before End Date.");
return false;
}
if (end != null && end.before(start)) {
errors.put("enddate", "End Date cannot be earlier than Start Date.");
return false;
}
return true;
</Source>
</ValidationScript>
</Field>
</Section>
<Button action="next" label="Submit"/>
<Button action="cancel" label="Cancel"/>
</Form>
but it threw this error:
Method getFieldValue(java.lang.String) not found in class 'sailpoint.object.Form'