- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2022 10:48 AM
When you select Planned Start Date on change form, validate if Planned Start Date is after 10 days of current date. If not display an error message below the field and clear the value selected.
Not able to change the date. Please help me with solution
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2022 12:16 PM
Hi
Please Create a Client script with the following configuration:
SCRIPT:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var minutes_from_now = 14400;
var date_obj = new Date(getDateFromFormat(newValue, g_user_date_time_format));
var future_date = new Date(new Date().getTime() + minutes_from_now*60000);
if(date_obj < future_date){
g_form.setValue('start_date', '');
g_form.showFieldMsg('start_date', "Planned start date must be 10 days from now.", 'error');
} else {
g_form.clearMessages();
}
}
Please mark this helpful/correct, if applicable.
Regards,
Muhammad
Servicenow Community MVP
Servicenow Developer MVP
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2022 12:16 PM
Hi
Please Create a Client script with the following configuration:
SCRIPT:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var minutes_from_now = 14400;
var date_obj = new Date(getDateFromFormat(newValue, g_user_date_time_format));
var future_date = new Date(new Date().getTime() + minutes_from_now*60000);
if(date_obj < future_date){
g_form.setValue('start_date', '');
g_form.showFieldMsg('start_date', "Planned start date must be 10 days from now.", 'error');
} else {
g_form.clearMessages();
}
}
Please mark this helpful/correct, if applicable.
Regards,
Muhammad
Servicenow Community MVP
Servicenow Developer MVP
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2022 03:19 PM
Hi AFreen,
Refer to the below link where i have shared similar solutions. you can use one of those.
Mark the comment as a correct answer and also helpful if this has helped to solve the problem.