- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2021 11:10 PM
Hi,
I have a requirement to auto populate due date field +3 business days with current date.
Can anyone help me to fix the issue?
I tried to add before insert BR but its not working as expected.
var sd = new GlideDateTime(gs.nowDateTime());
sd.addDays(3);
current.due_date=sd;
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2021 11:40 PM
If you want to show date after 3 days when user open new form (to create new record ) then you can set default value at dictionary level by overriding dictionary of due_date field.
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2021 11:38 PM
Hi,
sd.addDays(3); will not work in scoped app instead you can use
sd.addDaysUTC(3); or sd.addDaysLocalTime(3);
Your updated script would be:
var sd = new GlideDateTime(gs.nowDateTime());
sd.addDaysUTC(3);
//sd.addDaysLocalTime(3);
current.due_date=sd;
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2021 11:40 PM
If you want to show date after 3 days when user open new form (to create new record ) then you can set default value at dictionary level by overriding dictionary of due_date field.
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2021 11:45 PM
Hi,
gs.nowDateTime() is also not supported in scoped applications.
Your script should be like this:
var sd = new GlideDateTime();
sd.addDaysUTC(3);
//sd.addDaysLocalTime(3);
current.due_date=sd.getDisplayValue();
Thanks,
Anil Lande
Thanks
Anil Lande