Make group of checkboxes mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2023 04:55 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2023 02:00 AM
You can use "Selection Required" checkbox while creating the checkbox variable. Please see the screenshot below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2023 07:57 AM
I have tried that but it didn't work. but I have used another solution to use container variables to separate each checkbox. it works
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2023 03:42 AM
Hello @Sam M3 ,
Please use below script and check if it's work :
function onSubmit() {
/*******************************************************
/* Purpose: Check to make sure that the user has selected
/* a checkbox on the Record Producer before submitting
/* and cancels the submission if none of the checkboxes
/* are checked
/******************************************************/
var cbx_equipment = g_form.getValue('equipment');
var cbx_job_restructuring = g_form.getValue('job_restructuring');
var cbx_leave = g_form.getValue('leave');
var cbx_reader_or_interpreter_services = g_form.getValue('reader_or_interpreter_services');
var cbx_reassignment = g_form.getValue('reassignment');
var cbx_schedule = g_form.getValue('schedule');
var cbx_workplace_modification = g_form.getValue('workplace_modification');
var cbx_workplace_policy = g_form.getValue('workplace_policy');
var cbx_amended_working_hours = g_form.getValue('amended_working_hours');
var cbx_other = g_form.getValue('other');
if (cbx_equipment == 'false' && cbx_job_restructuring == 'false' && cbx_leave == 'false' && cbx_reader_or_interpreter_services == 'false' && cbx_reassignment == 'false' && cbx_schedule == 'false' && cbx_workplace_modification == 'false' && cbx_workplace_policy == 'false' && cbx_amended_working_hours == 'false' && cbx_other == 'false') {
g_form.clearMessages();
var msg = getMessage("Please select the type of accommodation(s) that you would like");
g_form.addErrorMessage(msg);
return false;
}
}
If my answer is useful, please mark my answer helpful and Accept the solution.
Thank you.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2023 05:46 AM
Hello @Sam M3,
If my answer is useful, please mark my answer as helpful and Accept the solution.
Appreciate your help!
Thank you.
Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2023 05:03 AM
Hi Sam,
To make a group of four mandatory checkboxes where all of them must be selected before submitting the form, you can use a UI Policy in ServiceNow. Here's how you can do it:
Navigate to the form where the checkboxes are located and click the gear icon in the top-right corner of the form. Select "Configure > UI Policies" from the dropdown menu.
Click the "New" button to create a new UI Policy. Give it a name, such as "Mandatory Checkboxes," and add a short description.
In the "Conditions" section, add the following condition: current.u_checkbox_group == true
Note: Replace "u_checkbox_group" with the actual name of the checkbox field that represents the group of four checkboxes.
In the "Actions" section, add the following action: current.u_checkbox_1 && current.u_checkbox_2 && current.u_checkbox_3 && current.u_checkbox_4
Note: Replace "u_checkbox_1," "u_checkbox_2," "u_checkbox_3," and "u_checkbox_4" with the actual names of the four checkbox fields.
Click "Submit" to save the UI Policy.
This UI Policy will make all four checkboxes mandatory and prevent the form from being submitted unless all four checkboxes are selected. When the user tries to submit the form without selecting all four checkboxes, they will see an error message indicating that all four checkboxes must be selected.
Thanks,
Rahul Kumar
Thanks,
Rahul Kumar