How to redirect KB article from notification

Bala13
Kilo Guru

HI,

I am trying to redirect the KB article from notification. How can i do that? I tried multiple ways but it is not redirecting.

Kindly help me please.

Notification is on Table : Knowledge Feedback

Article Number: ${article.number}  // here it should redirect

Article Title: ${article.short_description}

Thanks,

6 REPLIES 6

Chetan Mahajan
Mega Sage

Hi Bala,

                   Try below code in mail script

var kbObj;
var knowledgeGR =new GlideRecord('kb_knowledge');
knowledgeGR.addQuery(‘sys_id’,current.article);
knowledgeGR.query();
if(knowledgeGR.next()){
kbObj = knowledgeGR;
}

//Article link

"<b>Article Number</b>: <a href='https://" + gs.getProperty('instance_name') + ".service-now.com/sp?id=kb_article_view&sys_kb_id=" + kbObj.sys_id + " '>" + kbObj.number + "</a><br/>" 

 

Chetan Mahajan
Mega Sage

Hi Bala,

                you need to create Mail Script fro this as below

Create mail Script : knowledge_article_details

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {

    var knowledgeGR = new GlideRecord('kb_knowledge');
    knowledgeGR.addQuery('sys_id', current.article);
    knowledgeGR.query();
    if (knowledgeGR.next()) {

        //Article Number link
        template.print("<b>Article Number</b>: <a href='" + gs.getProperty('glide.servlet.uri') + "kb_view.do?sys_kb_id=" + knowledgeGR.sys_id + "'>"+knowledgeGR.number+"</a><br/>");
       // Article Title
        template.print("<b>Article Title:</b>:" + knowledgeGR.short_description + "<br/>");
    }

})(current, template, email, email_action, event);

Call this script in Notification Body as below

${mail_script:knowledge_article_details}

Result :

find_real_file.png

 

Kindly mark helpful and correct if applicable

Chethan,

 

I have written the notification on KB feedback table.

It is not working chethan. Could you please help me on this?

 

Hi,

Have you tried using below line:

Article Number: ${article.URI_REF}  // it will show Link with Display Value (i.e number)

 

Thanks,

Anil Lande