Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Add 90 days to the date field

Jet R
Tera Contributor

Hi, 

 

I need to have an on load client script that will default the value 90 days from today. 

 

This is a UI Page and I need to auto populate the Until Field. Please help.Thanks.

 

JetR_0-1666636909893.png

 

4 REPLIES 4

Yousaf
Giga Sage

Hi Jet,
Please check this article it has what you require also addition data time scripts.
Auto-populating and validating date fields 

 

Mark Correct and Helpful if it helps.


***Mark Correct or Helpful if it helps.***

Jet R
Tera Contributor

Hi @Ankur Bawiskar , 

Can you help me here? Thanks

Gontla Mythily
Tera Expert

Hi,

 

Try Business rule with GlideDateTime.

 

var gdt = new GlideDateTime(current.untill);
gdt.addYearsLocalTime(1);
var a = gdt.getDate();

current.untill= a;

 

Mark as correct if it helps
Regards Mythily

I cannot use a BR since this is in UI page.