- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2023 12:29 AM
The purpose of list collector is to select more than 1 records . Can we populate an alert message to select more than 1 record in list collector ServiceNow. Kindly let us know the update asap.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2023 03:49 AM
HI @Sowmya ,
I trust you are doing great.
You can do it using the client script on change one.
Once the value is changed into the list collector it will be passed to the backend where it will be shown as comma seperated sysIds for the reference.
var glideList = g_form.getValue('<glide list field>');
It will give output as sys_id1,sys_id2.
Then you can split it as given below :
var glideListArray = glideList.split(',');
if (glideListArray.length > 2) {
alert ('Invalid')
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2023 03:49 AM
HI @Sowmya ,
I trust you are doing great.
You can do it using the client script on change one.
Once the value is changed into the list collector it will be passed to the backend where it will be shown as comma seperated sysIds for the reference.
var glideList = g_form.getValue('<glide list field>');
It will give output as sys_id1,sys_id2.
Then you can split it as given below :
var glideListArray = glideList.split(',');
if (glideListArray.length > 2) {
alert ('Invalid')
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2023 06:00 AM
Hi Amit,
Thanks for the solution,
I tried the onchange client script which you suggested. But not working Basically it should throw an alert message if i select only one record in list collector.
function onChange(control, oldValue, newValue, isLoading) {
var glideList = g_form.getValue('user_list');
var glideListArray = glideList.split(',');
if (glideListArray.length > 2) {
alert ('Invalid');
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2023 09:01 AM - edited ‎06-16-2023 09:02 AM
Change this line as follows pls
if (glideListArray.length < 2)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2023 03:47 AM
Thank you its working