- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2020 10:01 PM
hi
i have 1 notification on incident table where i have to provide a link to kb article everytime this notification triggers.
so i wrote a email script and below is the code, but i only get the sys_id through it i want to print the content so how can i modify it to get results.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var link = new GlideRecord("kb_knowledge");
link.addQuery("number", "KB0010002");
link.addQuery("sys_id","add9a529dbd7b344123655784a96199e");
template.print("<b>Article is</b>: <a href='" + gs.getProperty('glide.servlet.uri') + "kb_view.do?sys_kb_id=" + link.sys_id + "'>" + link.number + "</a><br/>");
})(current, template, email, email_action, event);
am getting the link in my notification email script but when i click it gives record not found also it shows:
Article is : undefined
thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2020 04:11 AM
Hi,
you did not use link.query() and link.next() in your mail script because of which link.number is coming as undefined
Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.
Regards,
Asif
2020 ServiceNow Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2020 03:54 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2020 04:11 AM
Hi,
you did not use link.query() and link.next() in your mail script because of which link.number is coming as undefined
Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.
Regards,
Asif
2020 ServiceNow Community MVP