Add KB Article link in notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-15-2020 11:40 PM
Hi All,
I want to fetch the Kb article number from incident ,So there is a filed on incident form as u_knowledge which saves trhe kb article number. i want to give the link of that particular KB article in portal view from the notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-15-2020 11:57 PM
Hi Priya,
you need to use mail script for this
Name: show_kb_link
Include it in notification like this
${mail_script:show_kb_link}
Script:
Note: Ensure you use valid query based on whether u_knowledge is reference type or string type
(function runMailScript(current, template, email, email_action, event) {
var KbNumber = current.u_knowledge;
var kbRecord = new GlideRecord('kb_knowledge');
kbRecord.addQuery('number', KbNumber); // if KbNumber stores number
// OR
kbRecord.addQuery('sys_id', KbNumber); // if KbNumber stores sys_id
kbRecord.query();
if(kbRecord.next()) {
// this would take user to portal
var url = '/sp?id=kb_article&sys_id=' + kbRecord.sys_id + 'table=kb_knowledge';
template.print('<a href="' + url + '">' + kbRecord.number + '</a>');
}
})(current, template, email, email_action, event);
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-16-2020 01:22 AM
it is not working.i am not getting any link in the notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-16-2020 02:00 AM
Hi Priya,
u_knowledge is reference to kb_knowledge or string which stores KB number
you need to use proper query accordingly
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-16-2020 03:10 AM
yes i have used the sys_id one, it redirect one but it takes me to the portal but knowledge article record is not displayed .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-16-2020 03:28 AM
Hi Priya,
so to which page it is taking?
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader