- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2019 02:16 AM
hi team,
i am trying client script as below please correct if any thing wrong here
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var date_obj = new Date(getDateFromFormat(newValue,user_date_time_format));
var current_date=new Date();
if(date_obj<current_date){
g_form.showFieldMsg('Date','Date should not be past value',error,true);
}
else{
g_form.setValue('Date',current_date);
}
//Type appropriate comment here, and begin script below
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2019 03:54 AM
yes.
Date type variable on catalog form.
Catalog UI Policy
Result: i tried to select the 27th may and it gave me an alert.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2019 02:31 AM
ohk.. give a try with glide ajax.
adding one thread here. kindly read the last comment in below thread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2019 02:39 AM
there are 2 codes which code is correct ? can u paste here please

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2019 02:45 AM
Script include:
var NowDateCalc = Class.create();
NowDateCalc.prototype = Object.extendsObject(AbstractAjaxProcessor,{
getNow : function() {
return gs.now();
},
type: 'NowDateCalc'
});
Client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var start_date = g_form.getValue('start_date');
var ga = new GlideAjax("NowDateCalc");
ga.addParam("sysparm_name", "getNow");
ga.getXMLWait();
var rightNow = ga.getAnswer();
if ( start_date < rightNow) {
g_form.clearValue('start_date');
alert("Start date by cannot be earlier than today.");
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2019 03:34 AM
Hi harsha,
i am getting alert for past day selction.
even for future day selection. basically that is happening for any date selection, today , yesterday or tommarow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2019 03:36 AM
are you doing it on Personal instance ? if yes then i can quickly help you.
is it possible to share your screen on google hangout ?
because i tested with UI Policy or even with client script it is working for me.