- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2025 01:27 AM
Hello,
I have a list collector variable and an attachment variable. The attachment variable should only be visible and mandatory if the number of users in the list collector is more than 5.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2025 08:50 AM
Use an onChange Catalog Client Script similar to this:
function onChange(control, oldValue, newValue, isLoading) {
var usrArr = newValue.split(',');
if (usrArr.length > 4) {
g_form.setDisplay('v_attachment', true); //attachment variable name
} else {
g_form.setDisplay('v_attachment', false);
This should also cover hiding the variable when the form loads, but if not create a similar onLoad Catalog Client Script, replacing newValue with g_form.getValue('user_list').split(',') where 'user_list' is the name of your list collector variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2025 09:48 AM
please follow script shared by @Brad Bowman and that should solve your requirement.
💡 If my response helped, please mark it as correct ✔️ and close the thread 🔒 — this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2025 08:50 AM
Use an onChange Catalog Client Script similar to this:
function onChange(control, oldValue, newValue, isLoading) {
var usrArr = newValue.split(',');
if (usrArr.length > 4) {
g_form.setDisplay('v_attachment', true); //attachment variable name
} else {
g_form.setDisplay('v_attachment', false);
This should also cover hiding the variable when the form loads, but if not create a similar onLoad Catalog Client Script, replacing newValue with g_form.getValue('user_list').split(',') where 'user_list' is the name of your list collector variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2025 09:48 AM
please follow script shared by @Brad Bowman and that should solve your requirement.
💡 If my response helped, please mark it as correct ✔️ and close the thread 🔒 — this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thank you both
