- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 10:14 AM
Hello All,
I have a select box field, when the option Temporary is selected:
I have another select box below this, I would like 'All Department' to default and make this field read only.
How can i go about doing this?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 11:00 AM
Hi @Jen11 , write a onChange catalog client scrpt as below:
script :
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue == "abc") { //replace bac with Temporary choice value
g_form.setValue("s2", "pqr"); //replace s2 - select box 2 variable name and PQR with All Department' value
g_form.setReadOnly("s2", true); //replace s2 with select box varibale name
}
}
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 10:52 AM
@Jen11 Please add a UI Policy on your catalog item as follows.
This is how the end result look
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 11:00 AM
Hi @Jen11 , write a onChange catalog client scrpt as below:
script :
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue == "abc") { //replace bac with Temporary choice value
g_form.setValue("s2", "pqr"); //replace s2 - select box 2 variable name and PQR with All Department' value
g_form.setReadOnly("s2", true); //replace s2 with select box varibale name
}
}
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 12:30 PM
Thank you Hermanth!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 12:36 PM
@Hemanth so that's working, but when i go select Temporary, all department is set to default, when i change to something else beside temporary, all department doesn't change unless i refresh the page.