- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2018 04:06 AM
Hi Team,
I have configured an email notification on RITM table,would like to populate Task number in notification subject.There is an existing post , I could not find an answer. So please help me.
Regards,
Saridha.L
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2018 06:57 AM
as everybody already informed, you need to use email API setSubject to set the email subject with task number but just wanted to add one thing here is, setSubject will replace the whole email subject so if you want to put Task number along with other other email subject content then you can use the code provided by bhagya1764 by updating the below line of code.
email.setSubject(gr.number + ' : ' + 'YOUR REST OF THE EMAIL SUBJECT TEXT');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2018 04:10 AM
just add this in the subject
${number}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2018 04:12 AM
Hi,
You can achieve it by using email notification script if you have only one task associated with the requested item.
You need to query the sc_task table and fetch the right record based on the RITM and then put in a variable.
Once you have the variable, just use email.setSubject method to populate task number in subject.
https://docs.servicenow.com/bundle/jakarta-servicenow-platform/page/script/server-scripting/concept/c_ScriptingForEmailNotifications.html
Please mark it correct/helpful based on the response.
Thanks
Gaurav

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2018 04:13 AM
Hi Saridha,
Does the Task number refer to Catalog Task or RITM? If RITM you can use ${number} & it should work well. If Catalog Task you would require notification mail script.
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2018 06:10 AM
Thank you all.
I have tried mail script, its not working. Since I have configured the notification on RITM, If I user${number}, its populating RITM Number.
Regards,
Saridha.L