Set Default Value of a date field to 30 days from today

wchaiwimol
Giga Contributor

Hello,

I'm trying to set the default value of date field to 30 days from today by using javascript. Any ideas how the code will look like? Thanks for the help

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You should be able to put the following in the default value field on that field's dictionary record.



javascript:gs.daysAgo(-30);



GlideSystem Date and Time Functions - ServiceNow Wiki


View solution in original post

4 REPLIES 4

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You should be able to put the following in the default value field on that field's dictionary record.



javascript:gs.daysAgo(-30);



GlideSystem Date and Time Functions - ServiceNow Wiki


Thanks Brad! That works


Hi Michael,



If that worked for you would you mind marking my answer correct? Thanks!


Thanks Brad,

Its working