- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2017 12:52 PM
Hello -
We have a 'due date' field on one of our forms and we are looking to have that field default to 2 weeks from the Current Date/Time. I was looking around for the best way to accomplish this. I have not used Dynamic Default values in a field before, but I am wondering if this is the best place to do this. Essentially the user will be clicking on a Create New Form link and I want the Due Date field on that form to default to 14 days from the current time that the form was opened.
Thanks!!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2017 01:08 PM
Use below in default value.
javascript:var d = new GlideDateTime(); d.setValue(gs.daysAgo(-14)); d.getDisplayValue();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2017 01:08 PM
Use below in default value.
javascript:var d = new GlideDateTime(); d.setValue(gs.daysAgo(-14)); d.getDisplayValue();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2017 01:15 PM
That did it! Thank you!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 09:16 AM
I took this answer and refreshed it so it's easier to ready. ( I hate double negatives 😉)
Granted I only needed the date:
javascript:var d = new GlideDateTime(); d.addDays(14); d.getDate();
or if you need date/time
javascript:var d = new GlideDateTime(); d.addDays(14); d.getDisplayValue();
Validated in the Global scope, screen cap from sys_user table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2021 10:03 AM
Thank you Deepak. Is there a way to not allow prior dates from being selected? Make them read only?