"Question" choice in subcategory visible when category is empty or None in case table

sreeshsurendran
Tera Guru

Hi all,

 

We have a requirement in Complaints table where once the Category is empty or selected "None", the subcategory shouldn't show any choices except "None" or empty. but OOTB we could see "Question" choice visible in the list of subcategory choices once category is empty or none (refer screenshot below).

 

Note: Complaints table is extending Case [sn_customerservice_case] table.

 

sreeshsurendran_0-1745386217696.png

 

Any help where we can bypass this choice and display no choices when Category is selected as empty.

 

Thanks & Regards,

Sreesh Surendran

 

1 ACCEPTED SOLUTION

@sreeshsurendran 

something like this in onChange of category

function onChange(control, oldValue, newValue, isLoading) {
  if (isLoading) return;

  if (!newValue || newValue == 'None') {
    g_form.clearOptions('subcategory');
    g_form.addOption('subcategory', '', '-- None --'); // or whatever your 'None' value/label is
  } else {
    // Optionally, repopulate subcategory choices based on selected category
    // Or allow default behavior if subcategory is dependent
  }
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

4 REPLIES 4

J Siva
Tera Sage

Hi @sreeshsurendran 

The is because the dependent value on the sys_choice record is empty. To bypass this, simply fill in a dummy value in the dependent field on the choice list OR you can make the choice inactive if not required.

 

Before adding dependent value:

JSiva_1-1745386841572.png

 

JSiva_0-1745386807193.png

After adding dependent value:

JSiva_3-1745387004501.png

 

JSiva_2-1745386981892.png

 

Regards,
Siva

 

 

Ankur Bawiskar
Tera Patron
Tera Patron

@sreeshsurendran 

rather than touching the OOTB dependency logic between category and subcategory you can use combination of client script + ui policy

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@sreeshsurendran 

something like this in onChange of category

function onChange(control, oldValue, newValue, isLoading) {
  if (isLoading) return;

  if (!newValue || newValue == 'None') {
    g_form.clearOptions('subcategory');
    g_form.addOption('subcategory', '', '-- None --'); // or whatever your 'None' value/label is
  } else {
    // Optionally, repopulate subcategory choices based on selected category
    // Or allow default behavior if subcategory is dependent
  }
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Thanks @Ankur Bawiskar , the solution given worked 🙂