Add 30 Days to Expected Date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 12:02 AM
Hi All,
Need assistance on adding 30 days to expected date
we have multiple formats of date YYYY-MM-DD or DD/MM/YYYY or DD-MM-YYYY or MM-DD-YYYY
I would help with script where Field A should any format as per user profile, however should be able to calculate as setvalue + plus 30days date with format of User profile.
Key role: User profile date format.
Eg: User: Crish | FIeld A: 2017-07-24 | FIeld B should be 2017-08-23
Eg: User: Veer | FIeld A: 25/07/2017 | FIeld B should be 24/08/2017

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 12:33 AM
Hello Vamsi,
Refer the below script may helpful to you.
var myValidTo = current.valid_to;
myValidTo = myValidTo.toString() + ' 00:00:00';
var gdt = new GlideDateTime(myValidTo);
gdt.addDays(30);
var gdtStr = gdt.toString();
var reminderOnStr = gdtStr.substring(8, 10) + '-' + gdtStr.slice(5,7) + '-' + gdtStr.substring(0, 4);
current.u_reminder_on = reminderOnStr.
Adding 30 days to a date field when another field changes
Set date field value on change
Set Default Value of a date field to 30 days from today
ServiceNow Commnunity MVP -2018 class.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 02:43 AM