Email notification get name of user who commented

CE_
Tera Contributor

Hi,

I'm configuring a notification and email templates on "case commented". I'm trying to get the user who wrote the comment to be captured. I tried with the solution in this thread but it didnt work: https://www.servicenow.com/community/spm-forum/how-to-get-quot-updated-by-quot-name-in-the-notificat....

So I want it to be like
Best regards,
"First name (not last name) of user who wrote the comment"


How do I fix this? 

5 REPLIES 5

Tony Chatfield1
Kilo Patron

Hi, the post you have linked to shows the appropriate solution IE a notification email script that looks up the sys_user record based on the current records sys_updated_by field.

if this is not working for you the issue is most probably implementation, perhaps you could share details of your notification and the notification email script that you created. Plain text xml files of both records would be the easiest way to share this detail.

Community Alums
Not applicable

Agreed, the solution provided looks appropriate, @CE_ could you provide your code?

I've tried using the exact same code as both Otmane and Siddartha in the other thread, but none of them works. Like nothing shows up on my notification, it's just empty between "Best regards" and the company logo, not even a new empty line. 
In my Email Layout it's written like this:

${notification:body}

Best regards,

${mail_script:updated_by}
(And here is an company logo)

 

Basheer
Mega Sage

Hi @CE_ ,

Can you paste your written code.

It should be like this in your email script once you've passed the value

var gr = new GlideRecord('sys_user');
gr.addQuery('user_id',current.sys_updated_by);
gr.query();
while(gr.next())
{
template.print(gr.first_name);
}

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.