CAB date validation based on created date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 01:04 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 05:50 AM
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