- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
I'm trying to create a dynamic filter option on ends field for the delegate record. I want to take the current date add 1 week with the time defaulted to 23:59:59. I am able to add 1 week but I cannot figure out how to get the time to get set to 23:59:59. Right now the default was set to 1st day of 2100 which doesn't make sense as who because who has 74 years of vacation time available.
Edit: This is what I came up with. It works fine in scrips background but does not work in dynamic filter.
var d = new GlideDateTime(); d.addDays(7); var datePart = d.getDate();d.setValue(datePart + " 23:59:59");
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Yours did not work for me either. So I deleted the records and recreated it. It still did not work with your code or mine. So I deleted it again and this time when I created the record I gave it a label of "default one week" instead of "1 week". Now it is working which is strange since labels usually do not effect the system but both my code and your work with the new label.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @brianlan25, I think you are really close. This seems to work as a filter, which is then set to default. I used the Displayvalue with LocalDate in order to avoid UTC issues, not sure if that was your initial issue.
var d=new GlideDateTime(); d.addDays(7); d.setDisplayValue(d.getLocalDate().toString() + " 23:59:59"); d
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Yours did not work for me either. So I deleted the records and recreated it. It still did not work with your code or mine. So I deleted it again and this time when I created the record I gave it a label of "default one week" instead of "1 week". Now it is working which is strange since labels usually do not effect the system but both my code and your work with the new label.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Can use setDisplayValue() or setValueUTC() after constructing the datetime.