How to Add Current Date and Time in Flow Designer Send Email Action's Email Body?

Marium_07
Tera Contributor

Hi everyone,

I'm currently working on a workflow in Flow Designer within ServiceNow, and I'm using the Send Email action to notify users about certain events. I'd like to include the current date and time in the email body dynamically.

Could someone guide me on how to achieve this? Is there a specific variable or function I can use within the email body field of the Send Email action to automatically insert the current date and time when the email is sent?

Your insights and assistance would be greatly appreciated!

Thank you in advance.

Best regards, 

Marium

1 ACCEPTED SOLUTION

Anirudh Pathak
Mega Sage

Hi @Marium_07,

You can achieve this using flow variables.

Please follow the below steps -

1. Create a flow variable of date/time type.

ani07_0-1710311435894.png

2. Set the flow variable using flow logic, set the variable before send email action.

ani07_2-1710311536931.png

 

ani07_1-1710311493837.png

In the script section of set flow variables use below code - 

var gdt = new GlideDateTime();
return gdt.getValue();
 
3.Using Data pill picker set the value in the body section 
ani07_3-1710311643844.png

 

 

View solution in original post

2 REPLIES 2

Anirudh Pathak
Mega Sage

Hi @Marium_07,

You can achieve this using flow variables.

Please follow the below steps -

1. Create a flow variable of date/time type.

ani07_0-1710311435894.png

2. Set the flow variable using flow logic, set the variable before send email action.

ani07_2-1710311536931.png

 

ani07_1-1710311493837.png

In the script section of set flow variables use below code - 

var gdt = new GlideDateTime();
return gdt.getValue();
 
3.Using Data pill picker set the value in the body section 
ani07_3-1710311643844.png

 

 

Hi @Anirudh Pathak ,

I wanted to extend my sincerest thanks for your assistance. I truly appreciate the time you took to help me resolve the issue.