- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2019 12:10 PM
I want to define a mail script that will insert the content of a knowledge article. I also don't want to have to use a separate mail script for each KB we want to use in our notifications.
I'm wondering if there is a way to call a mail script in such a way that is passes a string to the script itself. This way in the notification's definition I can provide the sys_id of the KB article I want to insert.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2019 12:23 PM
If using an event then refer to this article: https://community.servicenow.com/community?id=community_question&sys_id=b9b08765db98dbc01dcaf3231f96...
I did something a little different. I embedded an email script withing a notification and used a field on the notification's triggering record to populate my script. In the example below, I used this process to embed a custom date into an email.
Note: "current.scheduled_notification" is a field on the Notification Trigger table in the second screenshot (underlined in red).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2019 12:14 PM
It should be pretty easy. But depends on the way you are calling the notification. If you are calling the notification from a scheduled job, you must already be sending the object of the knowledge record.
I would just add ${text} to the notification body and it should work.
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2019 12:16 PM
You can't pass a parameter to a mail script like that, but if you are triggering the notification with an event, you can send the string as one of the event parameters and call that event parameter in the mail script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2019 12:23 PM
If using an event then refer to this article: https://community.servicenow.com/community?id=community_question&sys_id=b9b08765db98dbc01dcaf3231f96...
I did something a little different. I embedded an email script withing a notification and used a field on the notification's triggering record to populate my script. In the example below, I used this process to embed a custom date into an email.
Note: "current.scheduled_notification" is a field on the Notification Trigger table in the second screenshot (underlined in red).