We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Hide select box choice on catalog item

DreDay3000
Tera Guru

Hello I am trying to hide a value from a select box on a catalog item based on a value selected in another field. 

Screenshot 2026-02-26 082332.png
The "Backup Job Failure" value in the Action field should only show when "Hosting Location" is ANG Non-Co-located

Screenshot 2026-02-26 082511.png

Screenshot 2026-02-26 082528.png

 
 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@DreDay3000 

you can use onChange catalog client script on that Hosting location variable, check value and remove the option

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    // give correct choice value to compare here
    if (newValue == 'ANG Non-Co-located')
        g_form.removeOption('actionVariable', 'backup_job_failure'); // give correct variable name and correct choice value here
    else
        g_form.addOption('actionVariable', 'backup_job_failure', 'Backup Job Failure'); // give correct variable name and correct choice value here
}

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@DreDay3000 

you can use onChange catalog client script on that Hosting location variable, check value and remove the option

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    // give correct choice value to compare here
    if (newValue == 'ANG Non-Co-located')
        g_form.removeOption('actionVariable', 'backup_job_failure'); // give correct variable name and correct choice value here
    else
        g_form.addOption('actionVariable', 'backup_job_failure', 'Backup Job Failure'); // give correct variable name and correct choice value here
}

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Tanushree Maiti
Giga Sage

Hi @DreDay3000 

 

if you are populate select box variable (var1)choices based on other variable (var2) value selection , then create onchange client script on that variable (var2).

var var1 = g_form.getValue("var1");

if(newValue=="catalog_value")
{
g_form.removeOption('var1','option to be cleared');

}

else{

g_form.addOption('var1','add that option again here');

}

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

@Tanushree Maiti 

FYI: addOption() requires 3rd parameter as well which is choice label.

Please check docs

56.png

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

KanteS
Giga Guru

Hi,

To hide a specific choice in a Select Box variable based on another variable’s value, use an onChange Catalog Client Script in ServiceNow.

Since you only want to control one option in the Action field, use g_form.removeOption() and g_form.addOption().

Create the client script on the variable and conditionally remove or add the required choice in the Action field based on the selected value.

If this resolves your issue, please mark the response as correct.