- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 10:27 PM
Hi,
I want to display the name of the created by instead of user id, below script dispalying the user id of the record in the email notification. could you please help me
Application ${name} created by ${sys_created_by} with MRC Accreditation ${u_mrc_acc}.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 11:20 PM
Hi @sushmachava
You need to query the user table with user id details and get the name.
Write a mail script with below logic and include in body of the notification.
var grSysUser = new GlideRecord('sys_user');
grSysUser.addEncodedQuery("user_name=" + current.sys_created_by);
grSysUser.query();
if (grSysUser.next())
template.print("Application" + current.name + "created by " + grSysUser.name + " with MRC Accreditation " + current.u_mrc_acc);
Scripting for email notifications
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 11:12 PM
Hi @sushmachava ,
Created by is a system created (OOB) string field type and populated when record is inserted to database (i wouldn't recommend to change this logic to display Name instead user id)
Can you use Opened by instead >> ${opened_by} which gives Name.
Thank you,
Hemanth
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 11:20 PM
Hi @sushmachava
You need to query the user table with user id details and get the name.
Write a mail script with below logic and include in body of the notification.
var grSysUser = new GlideRecord('sys_user');
grSysUser.addEncodedQuery("user_name=" + current.sys_created_by);
grSysUser.query();
if (grSysUser.next())
template.print("Application" + current.name + "created by " + grSysUser.name + " with MRC Accreditation " + current.u_mrc_acc);
Scripting for email notifications
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 11:47 PM
Thanks Voona