We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Dynamic filter Options End Date Delegaton

brianlan25
Kilo Patron

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");

1 ACCEPTED SOLUTION

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.

View solution in original post

3 REPLIES 3

ServiceTechNow
Tera Contributor

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

 

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.

swapnilshir
Tera Contributor

Can use setDisplayValue() or setValueUTC() after constructing the datetime.