- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 12:49 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2016 10:01 AM
Please check your instance. I have created a new onchnage client script and script include. It is working as expected.
onChange:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('ValidateDate');
ga.addParam('sysparm_name','dateValidation');
ga.addParam('sysparm_date',newValue);
ga.getXML(CallBack);
function CallBack(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer=='true'){
alert("pls select atleast 48hrs or more from now");
g_form.setValue('lpar_refreshed','');
}
}
}
Script include:
var ValidateDate = Class.create();
ValidateDate.prototype = Object.extendsObject(AbstractAjaxProcessor, {
dateValidation: function(){
return (gs.dateDiff(gs.nowDateTime(),new GlideDateTime(this.getParameter('sysparm_date')), true)/3600<48);
},
type: 'ValidateDate'
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2016 09:02 AM
Do you have a personal developer instance? I will look into it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2016 09:41 AM
https://dev22210.service-now.com/navpage.do
user name : admin
pw: vijay5484
u can login into it and i created a category caleld Unix items , in it i
created a field with name i need.
for this field , when user selects any date and time , then script should
check whether that selected date time is 48hrs from the time he is
selecting . if not then a dialogue box saying pls select atleast 48hrs or
more from now .
On Thu, Sep 15, 2016 at 12:03 PM, abhi_r <community-no-reply@servicenow.com>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2016 10:01 AM
Please check your instance. I have created a new onchnage client script and script include. It is working as expected.
onChange:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('ValidateDate');
ga.addParam('sysparm_name','dateValidation');
ga.addParam('sysparm_date',newValue);
ga.getXML(CallBack);
function CallBack(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer=='true'){
alert("pls select atleast 48hrs or more from now");
g_form.setValue('lpar_refreshed','');
}
}
}
Script include:
var ValidateDate = Class.create();
ValidateDate.prototype = Object.extendsObject(AbstractAjaxProcessor, {
dateValidation: function(){
return (gs.dateDiff(gs.nowDateTime(),new GlideDateTime(this.getParameter('sysparm_date')), true)/3600<48);
},
type: 'ValidateDate'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2016 08:21 AM
Hello Abhinay,
Can we exclude weekends from this. For example, if a user is placing request on Friday then it should not allow Saturday and Sunday. The date should be selected on Tuesday.
Thanks & Regards,
Jag.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2016 01:20 PM
Yes you can. You will have to use schedules for this. See GlideSchedule API.
http://wiki.servicenow.com/index.php?title=Scoped_GlideSchedule_API_Reference#gsc.tab=0