Automatically select checkbox if other checkbox is selected
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2019 01:29 AM
Hi there,
I have some difficulties to set up one of the catalog item and I would like to ask for help if possible.
I've created the item with multiple checkbox A, B, C, D, E, F, G
I need to configure this item so when C is selected, checkbox B is automatically selected too or when G is selected, checkbox B and C are auto selected and no editable.
Each of the checkbox have variables and I tried to create a script to meet my expectation but no luck so far.
Thanks for your time.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2019 01:36 AM
It can be done with client script. Can you please share your script.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2019 04:00 AM
Hi,
I am afraid I do not have any experience with scripting so far.
Managed to set up all my items by using the Catalog UI Policies only.
I would like to start using script because it allows you to do a lot more.
So far the script looks like that:
function onChange(control, oldValue, newValue, isLoading) {
if (g_form.getvalue('var_FarmMapping'), true)
g_form.setvalue('var_BingMaps', true);
}
If C is selected, select B automatically.
The above it does not work. I found a few suggestions in other topics but no luck o far.
Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2019 04:15 AM
Hi there,
Try changing your if condition. The if condition should check / match something, for example:
function onChange(control, oldValue, newValue, isLoading) {
if(g_form.getValue('var_FarmMapping') == true) {
g_form.setValue('var_BingMaps', true);
}
}
Also look closely for using getValue and setValue.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2019 12:27 AM
Hi,
I am afraid I do not have any experience with scripting so far.
Managed to set up all my items by using the Catalog UI Policies only.
I would like to start using script because it allows you to do a lot more.
So far the script looks like that:
function onChange(control, oldValue, newValue, isLoading) {
if (g_form.getvalue('var_FarmMapping'), true)
g_form.setvalue('var_BingMaps', true);
}
If C is selected, select B automatically.
The above it does not work. I found a few suggestions in other topics but no luck o far.
Thank you.
B