Set default time in Date/Time field on catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2018 12:40 PM
I have a date/time variable on a catalog request. I need to set the time default to 20:00:00 when a date is picked and user can update the time if wanted. I tried below script where it is setting the time to 20:00:00 but users are not able to override it. Time is getting locked.
Any thoughts?
Catalog Client Script - OnChange of date/time field
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.setValue('AppOps_Requested_by_date', newValue.replace(/[0-2][0-9]:[0-5][0-9]:[0-5][0-9]$/,"20:00:00"));
//Type appropriate comment here, and begin script below
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2018 01:05 PM
Thanks, but no luck. it still sets the current time.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2018 01:35 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2018 01:43 PM
Try this it worked for me.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var dt = newValue.toString().split(' ');
g_form.setValue('AppOps_requested_by_date', dt[0] + ' 20:00:00');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2018 01:55 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2018 05:44 AM
You have to have a space before the 2 (" 20:00:00").