Customize Knowledge Subscription Emails
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2018 05:37 AM
Hello,
I have a requirement to update (customize) the Subscription emails that come out of the box for Knowledge Subscriptions (there are 5 total).
I am having a hard time understanding the logic the current emails are built on. It currently uses a Notification Mail script to pull in information, which I've pasted the name & code from that script.
I want to make this into a table format (to be consistent w/ the rest of our organization's emails)... is it possible to add HTML to this code here in to add a table? I have tried w/ no success. Also, I am looking to pull in the article Short Description and Author of the article.
Can anyone help with this? like I said I am not even sure where this is pulling from.
Thanks
Notification: Article commented
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var obj = new JSON().decode(event.parm2);
email.setSubject("Reg: Article "+obj.article_number+ " has been commented on "+obj.commented_on);
template.print("Hi "+obj.receiver+",<br/>");
template.print("<br/>");
template.print("An article that you have created/updated has received a new comment.<br/>");
template.print("<br/>");
template.print("<b>Article Number</b>: <a href='https://"+gs.getProperty('instance_name')+".service-now.com/kb_view.do?sys_kb_id="+obj.article_id + "'>"+obj.article_number+"</a><br/>");
template.print("<b>Commented By</b>: "+obj.commented_by+"<br/>");
template.print("<b>Received On</b>: "+obj.commented_on+"<br/>");
template.print("<b>Comment</b>: "+obj.comment+"<br/>");
template.print("<br/>");
template.print("If this comment requires you to update the article, you may do so from ");
template.print("<a href='https://"+gs.getProperty('instance_name')+".service-now.com/kb_knowledge.do?sys_id="+ obj.latest_version_id + "'>here.</a><br/>");
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2018 06:51 AM
Hi Sandy,
You can customise the subscriptions email for Knowledge Management but this will lead to problems while you will be upgrading to future releases. The code shipped by us won't get directly patched in your instance where you will be making customisations.
Still I can help you with the customisations.
For customising the HTML part you can edit the Notification email script. In this script using template.print() function you can render the html you want as you can see already we are using bold tags and line break tags in the example you have shared.
For pulling more information to display like article's short descriptions and author of the article you can edit Script Action named Activity Fanout Manager for KM. In this script action based on the activity we are raising events and also building the JSON object which gets passed along with the event. You can modify the JSON object to display additional details.
The below method gets called for commenting activity on the articles. I have highlighted the piece of code responsible for raising an event and passing the JSON object to notification mail script. (Notification: Article commented)
Please let me know if you need any additional information
Thanks,
Jiten
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2018 10:47 AM
I'm trying to add the short description of the article to all of the KM subscription emails, but I'm not having any luck. When the notification triggers it shows this as the Short Description: Short Description: [object Object]
Here's where I updated the Script Action to include Short Description.
What am I doing wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2018 01:54 AM
Hi,
Can you try changing the knowledge_obj.short_description variable value in getKnowledgeObject() method from gr.short_description to either gr.short_description+'' or gr.getValue('short_description'). This will stringify the object object response.
P.S Please mark the answer as helpful if it solves your issue.
Thanks,
Jiten
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2018 07:11 AM
Worked like a champ. Thanks!