How to show todays date in the subject of email

sandeep24
Tera Guru

How to show today's date in the subject of email

 

find_real_file.png

8 REPLIES 8

Hi,

I am also having similar requirement. I need the previous days date in the subject of email of scheduled report.  Do you have any work around please suggest.

 

Thanks,

Mahesh

@Mahesh79 You can set the subject in the mail script

 

Set subject as empty in notification and add the mail script to body

jaheerhattiwale_0-1672912201436.png

 

In mail script set the subject using email.setSubject function as shown in image below

jaheerhattiwale_1-1672912251718.png

 

 

Result:

jaheerhattiwale_2-1672912272337.png

 

 

Please mark as correct answer if this solves your issue.

 

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

Hi,

I have tried this one also . I am not getting the exact date.

Please find my code

Mahesh79_0-1672915800564.png

 

Thanks,

Mahesh

 

@Mahesh79 USe below script

 

var gdt = new GlideDateTime();
gdt.addDaysLocalTime(-1);

gs.info(gdt.getDate());
 
Please mark as correct answer if this solves your issue.
Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023