- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2017 12:37 PM
Hi,
I am trying to determine if there is a way I can make the 'Take me to the Article' link go back to the KB Article itself when creating an email notification that uses the kb_feedback table. Right now it is going back to the feedback record rather than the KB article. A text view of the notification is below. The 'Take me to the Article' link is using the script kb_article_take_me_to_the_kb_article. Of course the link does work on email notifications that use the kb_knowledge table.
Hello,
A Knowledge Article you authored has been commented or rated.
Number: KB0010022
Article Title: Test Microsoft KB Article
Star Rating:
Feedback: Very helpful, thank you
From: John Smith
Date: 2017-08-23 09:46:54 CDT
Take me to the Article
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2017 03:00 PM
Depends on how your script is build. I'm guessing you have copied the "take me to the incident" script and it will point to the "current" record. Which in this case is the kb_feedback record.
So in that case.. and I didn't change any text or so here, just change the link.
I copied the take me to the incident script and added 2 lines (nr 2 & 3) in the start and change 1 line (nr 5)
(function runMailScript(current, template, email, email_action, event) {
var getArticle = new GlideRecord('kb_knowledge');
getArticle.get(current.article);
var link = getArticle.getLink();
if (email_action.name != "Incident Resolved") {
template.print('<p><font size="3" color="#808080" face="helvetica">');
template.print(gs.getMessage('You can view all the details of the incident by following the link below') + ':');
template.print('</font></p>');
}
else {
template.print('<p><font size="3" color="#808080" face="helvetica">');
template.print(gs.getMessage('If you feel the issue is not resolved, please click the following link and reopen your incident') + ':');
template.print('</font></p>');
}
template.print('<font face="helvetica">');
var backgroundColor = 'background-color: #278efc;';
var border = 'border: 1px solid #0368d4;';
var color = 'color: #ffffff;';
var fontSize = 'font-size: 16px;';
var fontFamily = 'font-family: Helvetica, Arial, sans-serif;';
var textDecoration = 'text-decoration: none; border-radius: 3px;';
var webKitBorder = '-webkit-border-radius: 3px;';
var mozBorder = '-moz-border-radius: 3px;';
var display = 'display: inline-block;';
var padding = 'padding: 5px;';
if (email_action.name == "Incident Survey") {
color = 'color: #343d47;';
backgroundColor = 'background-color: #e6e8ea;';
border = 'border: 1px solid #bdc0c4;';
}
template.print('<a href="' + link + '"');
template.print('style="' + backgroundColor + border + color + fontSize + fontFamily + textDecoration + webKitBorder + mozBorder + display + padding);
template.print('">');
template.print(gs.getMessage('Take me to the Incident'));
template.print('</a>');
template.print('</font>');
template.print('<br><br>');
template.print('<p><font size="3" color="#808080" face="helvetica">');
template.print('Thank you.');
template.print('</font></p>');
})(current, template, email, email_action, event);
This will get you a link that opens up the article that the knowledge feedback was about.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2017 11:39 AM
Hi Adam,
Can you share the script kb_article_take_me_to_the_kb ?
Basically, try changing the reference in the script to:
'https://YOUR_INSTANCE.service-now.com/kb_view.do?sysparm_article='+current.number;
Although it might look a bit different there, so please share...
harel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2017 03:00 PM
Depends on how your script is build. I'm guessing you have copied the "take me to the incident" script and it will point to the "current" record. Which in this case is the kb_feedback record.
So in that case.. and I didn't change any text or so here, just change the link.
I copied the take me to the incident script and added 2 lines (nr 2 & 3) in the start and change 1 line (nr 5)
(function runMailScript(current, template, email, email_action, event) {
var getArticle = new GlideRecord('kb_knowledge');
getArticle.get(current.article);
var link = getArticle.getLink();
if (email_action.name != "Incident Resolved") {
template.print('<p><font size="3" color="#808080" face="helvetica">');
template.print(gs.getMessage('You can view all the details of the incident by following the link below') + ':');
template.print('</font></p>');
}
else {
template.print('<p><font size="3" color="#808080" face="helvetica">');
template.print(gs.getMessage('If you feel the issue is not resolved, please click the following link and reopen your incident') + ':');
template.print('</font></p>');
}
template.print('<font face="helvetica">');
var backgroundColor = 'background-color: #278efc;';
var border = 'border: 1px solid #0368d4;';
var color = 'color: #ffffff;';
var fontSize = 'font-size: 16px;';
var fontFamily = 'font-family: Helvetica, Arial, sans-serif;';
var textDecoration = 'text-decoration: none; border-radius: 3px;';
var webKitBorder = '-webkit-border-radius: 3px;';
var mozBorder = '-moz-border-radius: 3px;';
var display = 'display: inline-block;';
var padding = 'padding: 5px;';
if (email_action.name == "Incident Survey") {
color = 'color: #343d47;';
backgroundColor = 'background-color: #e6e8ea;';
border = 'border: 1px solid #bdc0c4;';
}
template.print('<a href="' + link + '"');
template.print('style="' + backgroundColor + border + color + fontSize + fontFamily + textDecoration + webKitBorder + mozBorder + display + padding);
template.print('">');
template.print(gs.getMessage('Take me to the Incident'));
template.print('</a>');
template.print('</font>');
template.print('<br><br>');
template.print('<p><font size="3" color="#808080" face="helvetica">');
template.print('Thank you.');
template.print('</font></p>');
})(current, template, email, email_action, event);
This will get you a link that opens up the article that the knowledge feedback was about.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2017 09:25 AM
Thanks Göran! This worked! I ended up putting the new code into a separate script to keep it specific for any kb_feedback notifications.