Valid To set a year from now

carlosrlara
Mega Expert

In knowledge in Istabul.

i want to set the Valid To date to default to one year from created. Presently, the default is to set it to 2020. This is done by a dynamic filter list

which looks like this

var d = new GlideDate(); d.setValue('2020-01-01'); d.getDisplayValue();

How could i use a dynamic filter list or some other option to set this field to be a year when article is submitted. Just like it i

find_real_file.png

1 ACCEPTED SOLUTION

carlosrlara
Mega Expert

This is worked


1. Right click on the 'Valid Field'


2. Click on personalize Dictionnary


3. On default Value tabs, write the script below (ensure that the 'Use dynamic default is unchecked) :


                  javascript: var dat = new GlideDate(); dat.setValue(gs.monthsAgo(-12));


                  dat.getDisplayValue();


4. Save


View solution in original post

10 REPLIES 10

carlosrlara
Mega Expert

This is worked


1. Right click on the 'Valid Field'


2. Click on personalize Dictionnary


3. On default Value tabs, write the script below (ensure that the 'Use dynamic default is unchecked) :


                  javascript: var dat = new GlideDate(); dat.setValue(gs.monthsAgo(-12));


                  dat.getDisplayValue();


4. Save