- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2022 07:22 AM
Hi,
I have action script in servicenow flow designer.
There from the UI there's a list collector, it inputs list of team members names,
So when in action script i need to get each of them separately to an array or list.
Later i should be able to access these each element one by one.
I have tried this code but it's not working as expected.
var completed=[];
var user_list=[];
var vaccinated=[];
var not_vaccinated=[];
var user_list=inputs.team_members;
for(var i=0; i < user_list.length; i++){
var gr_vacc_state=new GlideRecord('v_status');
gr_vacc_state.addQuery('u_employee_name',user_list[i]);
gr_vacc_state.addQuery('u_vaccination_status','vaccinated');
gr_vacc_state.query();
if(gr_vacc_state.next()){
if(completed==null)
{
completed.push(user_list[i]);
}
else
{
completed.push(user_list[i]);
}
vaccinated.push(user_list[i]);
}
else
{
not_vaccinated.push(user_list[i]);
}
}
outputs.vaccinated=completed;
outputs.not_vaccinated=not_vaccinated;
output shows like this, even output is not correct
My question is how to get each team member's sys_id separately to a list or array, from inputs.team_members list collector in action script.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2022 07:34 AM
Hi,
List collector returns comma separated string of sys_id's. You need to split it to iterate in for loop.
Replace the line var user_list=inputs.team_members; with the below script and see whether your issue is fixed
var user_list=inputs.team_members.split(',');
Palani

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2022 07:34 AM
Hi,
List collector returns comma separated string of sys_id's. You need to split it to iterate in for loop.
Replace the line var user_list=inputs.team_members; with the below script and see whether your issue is fixed
var user_list=inputs.team_members.split(',');
Palani