How to print date using email script in notification based on employment date for below condition

Adi13
Tera Contributor

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

6 REPLIES 6

Hi,

So what's the challenge? what's not working?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Saurav11
Kilo Patron
Kilo Patron

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.