How to achieve Notification body to contain the date when it was triggered?

Arpitha Gopalsw
Giga Guru

Hello experts!

 

I have a requirement to fulfill - there are 2 notifications configured, both are triggered using events. One event runs on 2nd thursday of every month & another runs on the BR which triggers on insert with certain conditions.

 

How can i add those triggering dates into my notification body. What should be the notification script?? Please help me in achieving this. 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Arpitha Gopalsw 

you can simply get the current date/time for this and print in email body

template.print(new GlideDateTime());

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

6 REPLIES 6

Tony Chatfield1
Kilo Patron

Hi, you might need to clarify requirements as the date\time that a sysevent is triggered will not be the exact date\time that a notification is sent from the platform.

Also, if your organization works across multiple time-zones, then you would need to identify the TZ that the timestamp was sent in.

Hi @Tony,

Thank you for your response. I need to populate the date only when the notification triggers. Is there any possibility that we can achieve this requirement is my primary question.

 

Regards,

Arpitha

Hi, normally this would be considered to be the sys_updated_on time for the record the notification is triggered for.

Tai Vu
Kilo Patron
Kilo Patron

Hi @Arpitha Gopalsw 

You can access field data in Event Queue by using object event in your mail script.

#Event Created Time.

event.sys_created_on

 

#Event Processed Time

event.process_on

 

Cheers,

Tai Vu