Variables - Auto populate

Vengeful
Mega Sage

Hello,

 

I have 2 variables for a specific request item that should be auto populate.

Valid from should be auto populate on the date of creation/submission.

Valid to is dependent to Validity.

If I select 1 week, the Valid to date should automatically populated based on the user’s selection.

Merza_0-1692670351884.png

Merza_1-1692670455698.png

 

How can I configure that kind of setup?

 

1 ACCEPTED SOLUTION

@Ankur Bawiskar 

I tried to add this on default value javascript:gs.nowDateTime() and it worked.

Merza_0-1692682585082.png

My problem now is the Valid to.

View solution in original post

15 REPLIES 15

@Vengeful 

add 7 days to current date/time and set it

javascript: var dt = new GlideDateTime(); dt.addDaysUTC(7); dt;

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello @Ankur Bawiskar 

It did not work

@Vengeful 

please share your default value screenshot where you wrote that

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 
Here

Merza_0-1692865176445.png

 

@Vengeful 

So what does it show as output?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader