Catalog Item and list collector: Requestor needs to select at least two users.

Joshua Camacho
Tera Guru

Hello, I am working on a Catalog item that is unique in a few ways.

One of the asks is that when a requestor is filling in the Catalog item they are asked to select at least two users who are identified as the "Owners" as part of the larger request.

 

I am using a list collector for the field referencing the sys_user table. 

 

The problem I am looking to solve is preventing and notifying the requestor that they need to select at least two users from the list prior to being able to submit the catalog request form.

 

I saw some client-side scripting suggestions on how to limit and remove too many selections, however, I am looking for the opposite and I am unsure of how to write a script to check how many users are selected and to prevent the form from being submitted unless at least two users are selected.

 

This is what I have so far

JoshuaCamacho_0-1675374550244.png

 

 

Thank you

Any suggestions

1 ACCEPTED SOLUTION

newhand
Mega Sage

HI@Joshua Camacho 

Follow below pics !

1.png2.png

Please mark my answer as correct and helpful based on Impact.

View solution in original post

5 REPLIES 5

BharathChintala
Mega Sage

@Joshua Camacho  you need to do 2 things 

 

1. in variable update more information as note Minimum 2 users need to select.

2. You should be writing onSubmit script not on change.

onSubmit you can check how many users selected in that field using same script if length is less than 2 return false with message as 2 owners should be selected or what you want.

 

Thanks,

Bharath

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala

newhand
Mega Sage

HI@Joshua Camacho 

Follow below pics !

1.png2.png

Please mark my answer as correct and helpful based on Impact.

I appreciate the reply. I see that is for desktop. I am looking to have this client script applied to the service portal interface. Will this work for that too? Thank you

@Joshua Camacho  In client script select UI Type as all. So it will work in both Desktop and Portal.

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala