Comma separated values not returning from script include to client script

Chenab Khanna
Tera Expert

Hi

I have a string variable where users enter names by comma separating( field name - colleagues1) and i have another variable which will store the email address of those names by comma separated.

I wrote a catalog client script and script include for this. It worked fine when the variable (colleagues1) where users are selected is a list collector but if the variable is a string, it isnt going in the loop and always just returning email address of 1st user selected. 

Please find the script include - 

find_real_file.png

I checked, the values are coming correctly from client script and the for loop is also running fine.

Works first time, but subsequently, it isn't going to else condition

1 ACCEPTED SOLUTION

Hi,

might be some space in the name

please try this and trim the value

gr.addQuery('name', count[i].trim());

Also did you check those users are having the email with @ whatever your query is

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

16 REPLIES 16

No Luck

Hi Chenab,

Try playing around with the addQuery which could be causing the issue.

gr.addActiveQuery();
//gr.addQuery('name', 'IN', count); //comment this
gr.addQuery('email', 'CONTAINS', '@companyemail');