How to get Approver name in to knowledge notification?

Ramu6
Tera Contributor

Hi All,

Actually we have one knowledge reject notification on the knowledge table , i want to get the approver person name who is rejected the article in the knowledge notification, so for that i have created one email script it shows as  "undefined'.

Email script;

 

var approvedUser;
    var approval = new GlideRecord("sysapproval_approver");
    approval.addQuery("document_id",current.sys_id);
    approval.addQuery("state","rejected");
    approval.query();
    if (approval.next()) {
        approvedUser    = approval.approver.first_name;
    }
    var emailContent = {};
    emailContent.templateContent =
    "<b>Author </b>: "+approvedUser+"<br/>" +
    "<br/>" +
    template.print(emailContent.templateContent);
 
Please help to achieve this
 
Thanks
Ramu
3 REPLIES 3

Danish Bhairag2
Tera Sage
Tera Sage

Hi @Ramu6 ,

 

If the notification is already created on approval table then u don't need to write a email script for that. In the notification body itself u can select that field from the right hand side by expanding it. Please refer the screenshot attached.

 

Thanks,

Danish

 

Danish Bhairag2
Tera Sage
Tera Sage

Hi @Ramu6 ,

 

On the other hand if u wish to go with email script try checking with below code

 

var approvedUser;

    var approval = new GlideRecord("sysapproval_approver");

    approval.addQuery("document_id",current.sys_id);

    approval.addQuery("state","rejected");

    approval.query();

    if (approval.next()) {

        approvedUser = approval.approver.getDisplayValue();

    }

    var emailContent = {};

    emailContent.templateContent =

    "<b>Author </b>: "+approvedUser+"<br/>" +

    "<br/>" +

    template.print(emailContent.templateContent);

 

@Danish Bhairag2 

Actually the notification was on the knowledge table , because of that i have written email script, i have tried above but still it prints "undefined"

 

Ramu6_0-1698494406575.png