- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
HI all ,
For the single user it is goving correct answer but for the multiple users it is giving undefined answer
Can anyone correct this script :
source.u_owner_name:- multiple user id is coming ,
return: undefined output is coming
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Source: u_owner_name
Target: List Collector (sys_user)
Input format: user1,user2,user3
answer = (function transformEntry(source) {
if (!source.u_owner_name)
return '';
var owners = source.u_owner_name;
var userIds = [];
var arr = owners.split(',');
for (var i = 0; i < arr.length; i++) {
var userVal = (arr[i] || '').trim();
if (!userVal)
continue;
var userGR = new GlideRecord('sys_user');
userGR.addQuery('user_name', userVal); // change if using email or name
userGR.query();
if (userGR.next()) {
userIds.push(userGR.sys_id.toString());
}
}
// List Collector expects comma-separated sys_ids
return userIds.join(',');
})(source);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
the target field is reference or list type?
you are returning name of users
share some screenshots
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
target field is list collector :list @Ankur Bawiskar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
then you should pass sysId and push array
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Would you mind closing your earlier questions by marking appropriate response as correct?
Members have invested their time and efforts in helping you.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader