Wants to remove duplicates from my lookup select box for category and subcategory

Pratiksha KC
Tera Guru

When I use a Lookup Select Box referencing the Incident table and select the category field:

  • It pulls all values from the incident.category field.

  • If you've localized categories (e.g., via the sys_choice table), it shows duplicate entries — like “Hardware” in English, French, German, etc.

  • These are not true duplicates but different sys_choice entries for different languages.

I Wants to remove duplicates from my lookup select box for category and subcategory variables in record producer and also wants to make subcategory dependent on category

 

I have created variable set- 

1. Category

PratikshaKC_0-1749103525721.png

2. Subcategory

PratikshaKC_1-1749103570219.png

 

What changes do I need to make to achieve the goal? 

 

 

1 ACCEPTED SOLUTION

@Pratiksha KC 

With english user I was able to see other choices as well, so now I added this as reference qualifier

It showed me only English.

So you can add that in subcategory as well in the end for language handling

javascript:'inactive=false^name=incident^element=category^language=' + gs.getSession().getLanguage();

AnkurBawiskar_3-1749125791391.png

 

AnkurBawiskar_4-1749125802658.png

Subcategory Variable Config:

AnkurBawiskar_5-1749126023156.png

Output: English user category, subcategory dependency working fine

It should work the same if Language is Spanish

category subcategory dependency language sys choice catalog item.gif

I believe I answered your question. I also attached the gif to this post so that you can pause and see

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

19 REPLIES 19

@Ankur Bawiskar 

 

did you try adding alert inside the script and see? yes. Alert is also not working

Are you checking with english user? Yes.

@Pratiksha KC 

unless your condition satisfied alert won't come.

Did you add alert in both the script section?

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

@Ankur Bawiskar 

 

Did you add alert in both the script section? - Yes. 

Still not working. Is there any other way?

@Pratiksha KC 

try with onChange client script and see what value comes in alert when that variable changes

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

@Ankur Bawiskar 

 

Below onChange client script worked 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        g_form.setVisible('u_vulnerability_severity_level', false);
        return;
    }
   
    if (newValue === 'Vulnerability') {
        g_form.setVisible('u_vulnerability_severity_level', true);
    } else {
        g_form.setVisible('u_vulnerability_severity_level', false);
        g_form.clearValue('u_vulnerability_severity_level');
    }
}
 
But why it was not simply worked with UI Policy script ?