- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2022 11:38 PM
I have a catalog item with multiple groups of label+checkboxes. Is there a way to make the user check at least one of the boxes in any of the groups? This is easy when we have only one group, but it is possible to make a UI policy that will work across the groups?
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2022 11:20 PM
Hi,
you will have to use onSubmit catalog client script and verify that
function onSubmit() {
var value1 = g_form.getValue('variable_1');
var value2 = g_form.getValue('variable_2');
var value3 = g_form.getValue('variable_3');
var value4 = g_form.getValue('variable_4');
var value5 = g_form.getValue('variable_5');
var value6 = g_form.getValue('variable_6');
var value7 = g_form.getValue('variable_7');
if(!value1 && !value2 && !value3 && !value3 && !value4 && !value5 && !value6 && !value7) {
g_form.addErrorMessage("Please select at least 1 variabel");
return false;
}
return true;
}
Regards
Ankur
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 - last edited 3 weeks ago
My customer insisted that he needs a solution before the submission of the form. So for anyone interested in a no-code solution, try the following:
- Create a UI Policy: Configure the Conditions to check if all checkboxes are unchecked:
- Checkbox 1 is false AND
- Checkbox 2 is false AND
- Checkbox 3 is false AND
- Checkbox 4 is false AND
- Checkbox 5 is false...
Ensure Reverse if false is checked.
- Add the UI Policy Actions: Select your first checkbox variable and make it mandatory.
Depending on your case scenario, you may need to repeat this step for all the checkboxes to not have an issue.
But for me I didn't need to do so, my scenario was like this :
Label
Box 1
Text field that shows if Box 1 is checked
Box 2
Text field that shows if Box 2 is checked
Box 3
Text field that shows if Box 3 is checked
Box 4
Text field that shows if Box 4 is checked
Box 5
Text field that shows if Box 5 is checked
