- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2018 07:19 AM
Hi,
Please help me script. I have date field named startdate, but I need for users not to be able to select any date before 5 days from today.
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2018 08:44 AM
Here's my OnChange Client Script that calls the same Script Includes (with the original name however) requiring that a due date is greater than 5 days out (note it is in seconds):
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var cdt = g_form.getValue('due_date'); //First Date/Time field
var ajax = new GlideAjax('ClientDateTimeUtils');
ajax.addParam('sysparm_name','getNowDateTimeDiff');
ajax.addParam('sysparm_fdt', cdt);
ajax.getXML(doSomething);
function doSomething(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
//5 days out
if (answer < 431000)
{
alert('The lead time to process this request is 5 days.' + '\n' + 'If this is an urgent request please contact the Service Desk for assistance escalating this request.');
//alert('The date value cannot be before 5 days into the future. Please correct.');
//g_form.clearValue("due_date");
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2018 11:39 AM
Shane, I'm having similar situation. Can you please help me in blocking future two weeks from the current date and all the past dates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2021 11:45 AM
Shane
Any idea why I can't get this to clear the date and also I need 30 days out and no matter what I pick
I get the pop up window