- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2025 04:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2025 05:51 AM
Hi @nandhini muthu ,
You can use calculated filed option like below.
Code:
var gdt = new GlideDateTime();
gdt.addDaysUTC(7);
gdt.getDate();
return gdt; // return the calculated value
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2025 05:07 AM
Hello @nandhini muthu ,
You can try the below onLoad client script:
function onLoad() {
// Get the current date
var currentDate = new Date();
// Add 7 days to the current date
currentDate.setDate(currentDate.getDate() + 7);
// Format the date to match the ServiceNow date format (yyyy-MM-dd)
var formattedDate = currentDate.toISOString().split('T')[0]; // Formats as yyyy-MM-dd
// Set the value of the date field (replace 'date_field' with your field name)
g_form.setValue('current_date_plus_7', formattedDate);
}
Output -
Please mark this as "correct" and "helpful" if you feel this answer helped you in anyway.
Thanks and Regards,
Ashish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2025 05:16 AM
no client script required
you can use default value with this
javascript: var gdt = new GlideDateTime(); gdt.addDaysUTC(7); gdt.getDate();
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2025 08:20 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2025 05:51 AM
Hi @nandhini muthu ,
You can use calculated filed option like below.
Code:
var gdt = new GlideDateTime();
gdt.addDaysUTC(7);
gdt.getDate();
return gdt; // return the calculated value
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------