How to make sure that the user choose only one value into a list collection

Alon Grod
Tera Expert

Hi,

I created a m2m table between sys_user_group and task tables. I created a UI Action on the incident table that when the user click on the button, he can choose multiple groups and add them to the current incident. Is there any way to make sure that the user will be able to choose only one group even though its a list collector? after the user chooses the groups and click save the records are inserted into u_m2m_task_sys_user_group as multiple records. Is there any way to abort the action and throw error to the screen if he chooses more than one group?

Screenshot 2023-09-20 at 20.57.28.png

Screenshot 2023-09-20 at 20.58.08.png

6 REPLIES 6

-O-
Kilo Patron
Kilo Patron

Make it a reference 🙂

Satyapriya
Mega Sage

Hi Alon,

        You can make it a reference field so that it will select only one group

Alon Grod
Tera Expert

@Satyapriya @-O- but before the user chooses a group, he need to click on the UI Action, Then a window with the groups should pop up and he needs to select a group

Sagar Pagar
Tera Patron

Hi @Alon Grod,

 

You can change field type to reference to select single value it it.

 

OR

 

You can take reference of below article to limit value selection in list collector type fields.

Limiting Number of Selections in a List Collector 

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow