How to allow selection of multiple items within a choice field?

ty_roach
Tera Guru

I'd like to create a custom field that provides a list of choices (e.g. A, B, C, D, E), but I want to allow more than one of the field's values to be selected (e.g. select A, C, D). How can I do that with the choice field? ...or should I be using a different field type?

7 REPLIES 7

Mark Stanger
Giga Sage

You can't do this with a choice field unfortunately. You have to use True/False or List fields to do multiple selections.


I implemented a similar multiple choice "variable" by using multiple checkbox variables, one per "choice value". Couple them with a label field to display the "choice variable" name. For example in your list of variables for the form you could have:

1. Label = My Options
2. Checkbox = option #1
3. Checkbox = option #2
4. Checkbox = option #3


This will appear under the heading "My Options" and show 3 options. Any one, two or three options may be selected.

Now this leaves me with a quandry though. If I want to require that at least one value is selected, how can I do that?
I'm experimenting with a client script, but so far it's been alot of trials with alot of errors.


That's great. What you've described is actually the same thing that I've written about on SNGuru.
http://www.servicenowguru.com/system-definition/multiple-checkbox-variables-service-catalog-surveys/

I've also got an article showing how to make checkboxes mandatory.
http://www.servicenowguru.com/scripting/client-scripts-scripting/checkbox-variables-mandatory/


I like your 2 fold approach, 1-mark the label as mandartory, 2- count the selected values and if it does not exceed a desired count ( 0 in my case ), pop up an alert.

This worked the very first time I tried it. Your comments in the scripts allowed me to easily make the modifications needed for my situation.

Thank you Mark!