- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2016 09:13 AM
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?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2016 10:17 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2016 09:56 AM
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