- 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 01:26 PM
Hi @Jen11 ,
put else loop and clear the value as below
else{
g_form.setReadOnly(“s2”,false);
g_form.setClearValue(“s2”);
}
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 11:06 AM - edited 10-13-2023 11:10 AM
Hi @Jen11,
You can create a simple UI policy as shown below ,
Script
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang