Multiple dependent values for closure codes

Rob96
Tera Contributor

I've created a specific set of closure codes (resolution codes) for one specific category of incident. I've set close_code to be dependent on category and have the choices for that specific category in place now for the new choices. The existing close codes need to still apply to all the other categories of incident but of course no longer do as a result of the additions I've made. I know from checking the answers to previous questions posed about using multiple dependent values that one way to achieve this is to recreate this set of choices multiple times per category. This will make our reporting more complex to maintain so I'd prefer not to take this route.

I have seen mention of other ways to achieve the use of one set of choices across the remaining categories by scripting but I don't know where to start as my JS is limited. Can anyone help please?

4 REPLIES 4

Sourabh26
Giga Guru

Hi,

 

As per my understanding on above query, you need to add some additional choices on close code for specific category and for other category the close code remains as OOB choices. If this is so then below are the things by which you can achieve this.

 

Suppose for category (Network) you need to have additional choices for close code

And for other categories the close code remains as OOB.

 

For Network category create a client script (OnChange - Category)

var cat = g_form.getValue();
if(cat == 'network'){
  g_form.clearOptions('close_code');This will clear all the existing choice.
  //Now add your choice for network category
  g_form.addOption('close_code', 'Value1', 'New Choice Lable 1', 1);
  g_form.addOption('close_code', 'Value2', 'New Choice Lable 2', 2);
  g_form.addOption('close_code', 'Value4', 'New Choice Lable 3', 3);
}

 

Mark this as Helpful/Correct, if Applicable.

 

Regards,

Sourabh

Rob96
Tera Contributor

  Hi Sourabh

Thanks for this. I've created the client script and made the modifications for the category and some sample choices. 

It isn't working for me. What have I missed? I removed the dependency of close code on category and haven't created the new choices to be used for the close codes for the specific category assuming they should be created by the script.

thanks

Rob

Share the screenshots for the configurations and form.

Rob96
Tera Contributor

I tried changing the use of var (cat) to look for the newValue and it is working now:

find_real_file.png

It's working in my personal dev instance but because the oldValue is populated when opening a new incident. In my client dev instance the incident starts with category -none- so it doesn't set the values until the incident has been saved with another category first.