- 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 08:49 AM
Hi Vijay.
You can follow me and then you will see a message icon and can start a private chat and you can share your instance credentials I can look into it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 08:59 AM
sorry , i cannot share my credentials . any other ways ?
On Thu, Sep 15, 2016 at 11:49 AM, abhi_r <community-no-reply@servicenow.com>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2016 03:18 AM
Hi,
This might be helpful:
Client Script Date/Time Functions
Thanks,
Deepak.
PS: Hit like, Helpful or Correct depending on the impact of the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2016 07:21 AM
Hi , thanks for response.
i will explain my requirement exactly .
when user selects some date in the calendar (as shown the varibale in the image above) , that date or duration selected by him should be 48hrs from the time he is placing request , if < 48hrs then a dialogue box shuld pop out saying that "Duration selected should be atleaset 48hrs minimum"/
please give the script for this .
thanks in Advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2016 06:13 PM
As others pointed you need to write an onChange client script on your LPAR variable and use Glide Ajax in your client script. Let me know if you need help in scripting.