- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 07:31 AM
Hi All,
I have a requirement where i need to send the notification to the users who update the incident. We have a email script which is already defined and is fetching the email instead of the name .
reference image :
I did write the email script to fetch the name instead of the email :
But this isn't fetching the name
How to achieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 07:38 AM
Hi @phr
Please change your email script to the one like below.
var usrGr = new GlideRecord("sys_user");
usrGr.addEncodedQuery("user_nameSTARTSWITH" + current.sys_updated_by);
usrGr.query();
if(usrGr._next()){
template.print(usrGr.getValue('name'));
}
Please mark my answer helpful 👍 and accept as a solution ✔️ if it helped.
Anvesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 07:38 AM
@phr In your email script, {$sys_updated_by} is used, which is nothing but the user_name of the user who updated the record (which on your instance is user's email (user email is used as user_name on your instance) hence it is showing the email).
Replace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 08:54 AM
Hi @Sandeep Rajput ,
I did write the code as attached in the image "getUpdatedBy" which wasn't working fine.
I modified the code now and is working fine.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 07:38 AM
Hi @phr
Please change your email script to the one like below.
var usrGr = new GlideRecord("sys_user");
usrGr.addEncodedQuery("user_nameSTARTSWITH" + current.sys_updated_by);
usrGr.query();
if(usrGr._next()){
template.print(usrGr.getValue('name'));
}
Please mark my answer helpful 👍 and accept as a solution ✔️ if it helped.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 08:57 AM