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.

Change and set the date field 30 days after

kartikey
Tera Contributor

Hi everyone,

I wish to change a date type field and set it's value to 30 days after the current record's state is changed to complete.
How can i do via client script? Could you please help me out?

Thanks,
Kartikey

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @kartikey 

 

You can use the glidedateTime class and add the 30 day in that.

 

https://docs.servicenow.com/bundle/washingtondc-api-reference/page/app-store/dev_portal/API_referenc....

 

 

https://developer.servicenow.com/dev.do#!/learn/courses/washingtondc/app_store_learnv2_scripting_was...

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Gangadhar Ravi
Giga Sage

you can try something like below in BR. 

 

 var gdt = new GlideDateTime();
gdt.addDaysLocalTime(30);
current.datefield = gdt;

  

Hi @GangaA ,

Could you let me know how to do it without a BR? using a client script?


Thanks