- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 10:43 PM
Hello,
I want to set limit of choices 5 on list collector.
How can we implement this any idea?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 11:06 PM
Hello @priyanka1028
You need to write a onSubmit() Catalog Client Script
Applies to Catalog Item
Applies on Catalog Item view - True
UI Type = ALL
function onSubmit()
var values = g_form.getValue('variableName').toString().split(',');
if(values.length > 5){
alert('Please select only 5 choices');
return false;
}
}
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Regards,
Samaksh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 11:05 PM
Hi @priyanka1028 ,
write onSubmit catalog client script
Applies to Catalog Item
Applies on Catalog Item view - True
UI Type = ALL
Note: give your list collector variable name below
function onSubmit()
{
var values = g_form.getValue('variableName').toString().split(',');
if(values.length > 3){
alert('Please select only 3 choices');
return false;
}
}
Also, refer to the link too for another way : https://servicenowguru.com/scripting/client-scripts-scripting/limiting-selections-list-collector/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 11:06 PM
Hello @priyanka1028
You need to write a onSubmit() Catalog Client Script
Applies to Catalog Item
Applies on Catalog Item view - True
UI Type = ALL
function onSubmit()
var values = g_form.getValue('variableName').toString().split(',');
if(values.length > 5){
alert('Please select only 5 choices');
return false;
}
}
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 11:11 PM
Actually I have tried this but I want solution like if we add more than 5 choices that time it wont be able to add those choices.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 11:13 PM