The CreatorCon Call for Content is officially open! Get started here.

How to use multiple checkboxes in a catalog item instead of list collector

tom_p94
Tera Contributor

Has anyone had any success in using multiple checkboxes on a catalog item instead of a list collector? The requirement is for the user to be able to select multiple checkboxes which then populates a singular RITM and SCTASK with whatever checkboxes were selected. This is so users can select multiple hardware items. 

5 REPLIES 5

DivR
Giga Contributor

Hi Everyone, Good Day !

I am implementing a similar requirement as mentioned above. Instead of using Catalog UI Policy and UI Actions, I have achieved this through a Catalog Client Script. Please have a look at the implementation below:

My Scenario: Checkbox Validation on Catalog Item Form

We need to ensure that at least one certification checkbox (CSA, CAD, CIS) is selected before allowing users to submit a Service Catalog Item. If none of the checkboxes are selected, an error message will appear next to the checkbox fields.

Implementation Steps:

1. Create a Label as 'Certifications' and Checkbox Variables: Create three Checkbox variables: CSA, CAD, and CIS on your catalog item form.

DivR_2-1758126583148.png

 

DivR_3-1758126631473.png

 

2. Add UI Script for Validation:
Go to Service Catalog > Catalog Items and open your catalog item.

In the Catalog Client Scripts tab, create a new UI Script with Type = onSubmit.

3. Use the Following Script in the Script Field:

 

function onSubmit() {
// Get the values of the checkboxes (using your field names 'csa', 'cad', 'cis')
var cad = g_form.getValue('csa') == 'true';
var csa = g_form.getValue('cad') == 'true';
var cis = g_form.getValue('cis') == 'true';

// If none of the certifications are selected
if (!cad && !csa && !cis) {
// Show error message on each checkbox field
g_form.showFieldMsg('csa', 'Please select at least one certification.', 'error');

// Prevent form submission
return false;
}

// Allow submission if any certification is selected
return true;
}


Steps to Add the Script:

Go to your catalog item in Service Catalog.

In Catalog Client Scripts, add a new UI Script with Type = onSubmit.

Paste the script in the Script field and save it.

Test the Script:

If none of the checkboxes are selected, the form submission will be prevented, and an error message will be displayed next to the checkbox field.

 

DivR_4-1758126754659.png

 

If at least one checkbox is selected, the form will be submitted as usual and RITM will be created as below:

DivR_0-1758126477212.png

 

Hope this is helpful!
Let me know if you have any queries. Happy learning!


Thanks,

Rajesh