Set default value for a date field to be six months from now

sharonjanisch
Tera Contributor

We are creating a custom application to keep track of security exceptions.     We have a date field on the form for the Next Review Date.     How do we set the default value for that field to be six months from the current date?

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

Put this in the default value of the field dictionary


javascript:   var gdt = new GlideDateTime();gdt.addMonthsLocalTime(6);gdt.getDate();


View solution in original post

7 REPLIES 7

That's it.   Thank you!


HI SHARAN,

I have the same scenario.default value for that field to be six months from the current date.still it is not working.Can you help me with the solution 

Subhojit Das
Kilo Guru

Hi Sharonjanisch,

 

Try adding the code in default value of your Date/Time field:

javascript:var gdt = new GlideDateTime();gdt.addMonths(6);gdt.getDisplayValue();

 

Regards,

Subhojit Das