Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 12:24 AM
Hi Team,
I want to retrive usernames from the sys id's in array.
currently, I'm having sysid's as below, want to retrive usernames from it. please help
var sysID = "38cf889783691015c83217f053af38,78ff69441becbd502cadea0ee54bcb59";
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 12:31 AM
Use this:
var sysID = "38cf889783691015c83217f053af38,78ff69441becbd502cadea0ee54bcb59";
var sysid_split = sysID.split(",");
var arr = [];
for(var i=0;i<sysid_split.length;i++)
{
var gruser = new GlideRecord("sys_user");
gruser.addQuery("sys_id", sysid_split[i]);
gruser.query();
if(gruser.next())
{
arr.push(gruser.user_name);
}
gs.info(arr.toString());
This will give you username.
Please mark as helpful and correct answer if it helps you.
Regards,
Shamma
Regards,Shamma Negi
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 12:31 AM
Use this:
var sysID = "38cf889783691015c83217f053af38,78ff69441becbd502cadea0ee54bcb59";
var sysid_split = sysID.split(",");
var arr = [];
for(var i=0;i<sysid_split.length;i++)
{
var gruser = new GlideRecord("sys_user");
gruser.addQuery("sys_id", sysid_split[i]);
gruser.query();
if(gruser.next())
{
arr.push(gruser.user_name);
}
gs.info(arr.toString());
This will give you username.
Please mark as helpful and correct answer if it helps you.
Regards,
Shamma
Regards,Shamma Negi
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 12:37 AM
Hi Shamma,
thank you so much it worked! 🙂