Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

Setting up Error message on screen if the scheduled end date is before the start date

Evelyn V
Tera Contributor

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! 😊

2 REPLIES 2

Sid_Takali
Kilo Patron

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);

 

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. 😞