CAB date validation based on created date

Reddy
Kilo Sage

Hello,

 

I have a requirement where I need to validate cab date based on change request created date. If a change request is created between Friday to Monday we should alert user asking to skip next week Tuesday and select the following week Tuesday as cab date.

1 REPLY 1

Kartik Magadum
Kilo Sage

Hello @Reddy 

 

To provide the user with a reminder/alert, you can use a client-side script to display a message when they try to select a CAB date within the restricted period (Friday to Monday).


Add the following client-side script to the "Client Script" section:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }

    var selectedDate = g_form.getValue('cab_date');
    var dayOfWeek = new Date(selectedDate).getDay();

    if (dayOfWeek >= 5 && dayOfWeek <= 1) { // Friday to Monday
        alert('Change Request created between Friday to Monday. Please select next week Tuesday for CAB date.');
        g_form.setValue('cab_date', ''); // Clear the CAB date field
    }
}

 

Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Thanks & Regards,

Kartik Magadum