Setting up Error message on screen if the scheduled end date is before the start date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 07:55 AM - edited 09-12-2024 07:56 AM
I was reviewing our open change requests, and I noticed the end date is before the start date. How can I set this up to have an error message displayed on the screen if the end date is before the start date. I believe a script is needed. Any help would be appreciated! 😊
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 09:49 AM
Hi @Evelyn V Create a Before Insert Update Business Rule on change_request table and use below script
(function executeRule(current, previous /*null when async*/) {
if (current.start_date && current.end_date) {
if (current.end_date < current.start_date) {
current.addErrorMessage('End date cannot be before the start date.');
current.setAbortAction(true);
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 10:44 AM
Hi @Sid_Takali,
Thank you so much for replying and your help!
I created the business rule as suggested. I included an attachment with screenshots if you may double check to see if I missed something please. I tested it but doesn't seem to work. 😞