I am trying to display a date 7 days from current day in the subject line

samallred
Kilo Contributor

I have a need to display a date 7 days from the current day in the subject line of a notification in a ServiceNow workflow.

new GlideDateTime(gs.daysAgo(-7)).getDate()

This JS works, but it doesn't work in the subject line of the notification.  

How do I put this JS into the subject line of the notification?

1 ACCEPTED SOLUTION

I would strongly suggest not using the Notification workflow activity. The To(script) is used to determine the recipients, it is not used to format the message. I would send an event instead. Here is a wiki article on using events in workflows:


Notification Activities - ServiceNow Wiki



Depending upon how this notification is being used will determine if we actually need this. It sounds like you want a custom subject for tasks that are generated. Is this correct?



You could leverage the task creation workflow activity to set the short description of the task:


Task Activities - ServiceNow Wiki


View solution in original post

5 REPLIES 5

Mihir Mohanta
Kilo Sage

Write a email script and override the subject line of the notification by writing script there like


email.setSubject("7 day after today is : "+ gs.daysAgo(-7));



Thanks,


Mihir