Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How can we hide a specific Subcategory option from the Subcategory choice list on the Incident form

Ria
Tera Contributor

We have a business requirement on the Incident form to hide one specific Subcategory option when the Category is set to Application. Both fields (Category and Subcategory) are standard choice fields on the Incident table.

We cannot deactivate this Subcategory choice at the dictionary level because:

  • The same Subcategory is still needed and actively used in other forms and processes, and
  • We are creating a new Catalog Item where this Subcategory must remain visible under the Application category by default.

Because of this, the Subcategory must remain active, but it should be hidden only on the Incident form when Category = Application. All other Subcategory choices must remain available.

Can anyone advise on the best approach to achieve this?

11 REPLIES 11

Hi @Tanushree Maiti 

We only need to hide one specific option, and all other 40+ Subcategory options should remain visible as they are.
Do we need to re‑add all 40+ options using g_form.addOption() to achieve this?

No , just test the code and confirm how it is working.

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

I created a client script, but it isn’t working as expected the option is still visible. (refer to attached screenshot)

Hi @Ria ,

In fresh Zurich PDI, removeOption() is not working any more ( though its working in our upgraded old client instance ).

 

Please follow the steps (using Script include ) as per KB article : 

 
Note: in one community post someone has confirmed that script include is working fine.
 
Let me know how it goes @Ria .
Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Ankur Bawiskar
Tera Patron

@Ria 

this is an easy requirement with onChange client script and using g_form.removeOption('subcategory','choiceValue');

Note: give exact choice value to remove

💡 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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader