- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2015 02:58 AM
Hi,
The below code takes a list collector full of names and prints them out as follows: user1,user2,user3. I would like to add a space after each comma like so. user1, user2, user3.
var answer1 = [];
var list1 = current.variables.admin_group_owners.toString();
var listArr1 = list1.split(',');
for (var i=0;i<listArr1.length;++i) {
var user1 = new GlideRecord('sys_user');
user1.addQuery('sys_id',listArr1[i]);
user1.query();
if(user1.next()){
answer1.push(user1.email.toString());
}
}
task.description = 'Group Members: ' + answer1;
Regards.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2015 03:06 AM
Hi Alex,
Try writing below lines of code at the end. This should give you required result.
var answer1_final = answer1.join(', '); //there is space after comma
task.description = 'Group Members: ' + answer1_final;
Thanks,
Tanaji

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2015 03:06 AM
Hi Alex,
Try writing below lines of code at the end. This should give you required result.
var answer1_final = answer1.join(', '); //there is space after comma
task.description = 'Group Members: ' + answer1_final;
Thanks,
Tanaji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2015 03:48 AM
Perfect,
I did look at join but was putting it in the wrong place.