Customize Substatus in incident template

sajal_chatterje
Tera Contributor

Hello community,

 

We have this existing configuration where the sub status depends on status field in service now. Now, there is a need to customize it based on CI selection and flag.

Eg :- If CI selected is "Xyz" and a flag is checked then for a status - pending option it should only display 3 sub status option. Current configuration displays 6 options for status pending

 

Question: -

Is it a good practice to customize this way?? If yes, how can we achieve it? Please let me know your thoughts. 

 

 

Thanks,

Sajal

4 REPLIES 4

Mark Manders
Mega Patron

Create a client script for this (onLoad/onChange -> hide the options when CI - xyz). Make sure all options are available through the dependencies added.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Hello Mark,

I tried using g_form.removeoption() but it is not working. Could you please help here?

 

Thanks!

Please share your entire script (and did you have it onChange and onLoad)?


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

It is defined on Change when status changed to "pending" because for status pending only substatus populates.

below is my script

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
   //var c=g_form.getValue('cmdb_ci');
   
   
   var stat=g_form.getValue('state');
var cmd=g_form.getValue('ci');
   if(stat=='3' && cmd=='sys id of record') {
   
    g_form.removeOption('hold_reason','6');
   
   
   
   
   }
 
 
   }