How to print date using email script in notification based on employment date for below condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2022 03:04 AM - edited ‎10-06-2022 03:07 AM
Condition= Employment start Date + 30 days + The 1st of the next month. Ex.- Employment start Date=10 Sept +30 = 10 October so I want to print 1 November using an email script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2022 03:47 AM
Hi,
So what's the challenge? what's not working?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2022 04:53 AM
Hello,
Based on the script you shared and assuming you have the notification on the same table as employment date field use the below script:-
var empDate = current.employment_start_date.getValue();
var returnDate = new GlideDateTime(empDate);
returnDate.addDays(30);
var gdt = returnDate.getDate();
gdt.addMonths(1);
var gd = new GlideDate();
gd.setValue(gdt.toString());
template.print(gd.getByFormat("MM-1-yyyy"));
Please mark answer correct/helpful based on Impact.