We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

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

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...

 

*************************************************************************************************************
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/dratulgrover [ 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