Setting a default time in a date/time field using a client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2009 03:32 AM
Hi,
I'm trying to set a default date and time in a time/date field using a client script, it should be set to todays date and a time of 5pm. Does anyone have an idea on how this might be possible.
I thought it might look like this but it doesn't seem to work:
function onLoad() {
g_form.setValue('start_date',gs.now()+' 17:00:00');
}
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2017 12:44 AM
Thank you Shishir Srivastava !! It worked for me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-14-2017 11:28 PM
Hi SNOW Istanbul
can u pls write a business rule for this
(function executeRule(current, previous /*null when async*/) {
var work_start = current.work_start;//pls adjust ur requirement field names here
var gdt = new GlideDateTime(work_start);
var current_date = gs.now();
gdt.addDays(7);
var lead_date = gdt.getDate();
gs.addInfoMessage(lead_date);
gs.addInfoMessage(current_date);
if(current_date>=lead_date){
gs.addInfoMessage('updated');
}
else{
gs.addInfoMessage('Please wait for 7 days for implememtation' );
current.setAbortAction(true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-14-2017 11:42 PM
Hi ahmed,
Simple way you can go to the field Dictionary in Default Value use this script: javascript:gs.now() + " 17:00:00 ";
Bye Default it tooks the current Date and Time 5PM.
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
‎10-12-2018 09:28 AM
nice one Admed! this works like a charm.