Need to get approver name.

niveditakumari
Mega Sage

Hello, 

 

Need to get approver name in notification. 

ex - when change request is going to approval, i need approver name in HTML template. 

Can anyone please help me with this. 

 

Regards, 

Nivedita 

 

1 ACCEPTED SOLUTION

Hi Nivedita,

 

 

Replace approv.query(); with below in your code once.

approv.addQuery('state','approved');

approv.orderByDesc('sys_upated_on');

approv.query();

View solution in original post

17 REPLIES 17

I is not calling that email script. 

It is printing log statement. 

Hi,

Is this notification triggered based on event?


Thanks,
Ashutosh

Hello Jaspal, 

 

Thank you for your reply. 

I tried this but it is not working. 

I want to get approver name who has approved change request. 

Can you please help me with this. 

 

Regards, 

Nivedita 

 

Gopi Kumar
Tera Contributor

Hi Nivedita,

 

Try the below code in the message of the notification. Update the conditions based on your instance configuration and system setup.

<mail_script>  

 

    var appRec = new GlideRecord('sysapproval_approver');

 

    appRec.addQuery('state', 'approved');// if approved is not working put the correct value of the approver state field

 

    appRec.addQuery('document_id',current.sys_id);

 

    appRec.query();

 

    while (appRec.next()) {

 

      template.print("<ul><li>Approved By: " +appRec.approver.name+"</li></ul>");

 

    }

 

</mail_script>  

Mark it as helpful if it works.

For More Information check this link: https://community.servicenow.com/community?id=community_question&sys_id=e9374b29db1cdbc01dcaf3231f96...

Regards,

Pavan

niveditakumari
Mega Sage

Hi, 

 

Can anyone please help me with this? 

 

Regards, 

Nivedita