Email notification get name of user who commented
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 12:41 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 04:29 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 04:59 PM
Agreed, the solution provided looks appropriate, @CE_ could you provide your code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2023 12:28 AM
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)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 05:36 PM
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 mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.