- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
If you are seeing incorrect start and end dates on change requests — for example, users are able to submit or modify a request with a Planned start date later than the Planned end date without a warning message - you can implement a custom script that verifies the start and end dates before you enter the time warp:
A date validation script for the start- and end-date fields can be set to trigger on the change request record. This script will check the start date against the current date, and display an error message if the start date is before the current date. It will also check the end date against the start date, and also display an error message if the end date is before the current date.
To verify these dates on a change request, one way is to create a business rule before insert or update:
- For example: Condition = current.start_date.changes() || current.end_date.changes() || current.work_start.changes() || current.work_end.changes())
- Use this script:
if (!current.end_date.nil() && !current.start_date.nil()) {
if (current.end_date.getGlideObject().getNumericValue() <=
current.start_date.getGlideObject().getNumericValue() ) {
gs.addErrorMessage('Planned start must be before Planned end');
current.start_date.setError('Planned start must be before Planned end');
current.setAbortAction(true);
}
}
if (!current.work_start.nil() && !current.work_end.nil()) {
if (current.work_end.getGlideObject().getNumericValue() <=
current.work_start.getGlideObject().getNumericValue() ) {
gs.addErrorMessage('Actual start must be before Actual end');
current.work_start.setError('Actual start must be before Actual end');
current.setAbortAction(true);
}
}
This message should now appear at the top of the change request if the dates are incorrect:
For more about using scripts to verify dates, see:
Change requests can be saved with a start dates later than the end date without warnings
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.