- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2018 12:35 PM
Hello - is there an easy way to set a default time on the date/time field variable? We have a need for the date picker to default to 8:00am EST when you open the calendar to pick the date/time.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2018 10:22 AM
I got it working using below script
function onLoad() {
var ajax = new GlideAjax('MyDateTimeAjax');
ajax.addParam('sysparm_name', 'nowDateTime');
ajax.getXML(function () {
var test = ajax.getXMLAnswer(function(answer){
var response = JSON.parse(answer);
//alert(response.datetime);
g_form.setValue('date_time_deployment', response.datetime);
});
});
}
var MyDateTimeAjax = Class.create();
MyDateTimeAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {
nowDateTime: function () {
var Date = new GlideDate();
var datetime = (Date + ' 08:00:00');
var response = {};
response.datetime = datetime;
return JSON.stringify(response);
},
type: 'MyDateTimeAjax'
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2018 09:01 AM
Do you have client script that has ui type set to All.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2018 09:12 AM
Right now it's set to Desktop, not All.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2018 09:17 AM
you need to set it to all so it works on both. (portal and desktop)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2018 09:10 AM
also try
var date = ajax.getAnswer() + ' 08:00:00';
g_form.setValue('date_time_deployment', date);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2018 09:16 AM
I removed the other script and added this.. it didn't work either.