Make one value in Choice list "read only".

andersn
Giga Contributor

Hi,

Is it possible to make one value in State "read only". What im trying to accomplish is to make State "New" read only for incident, so that this state isn't possible to set manually, only by rules..

Anyone tried anything similar?

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Sorry Anders. It's a function of most browsers that choice lists (aka select lists) display the values they have. You could use an onLoad client script to remove the option.



g_form.removeOption('state', 'New'); //Adjust New to the proper state VALUE, e.g. 1)



Reference:


GlideForm (g form) - ServiceNow Wiki


View solution in original post

11 REPLIES 11

If the objective is to make the entire field read-only given a certain condition (state == 1, for example) I strongly recommend a UI policy for easier maintenance.



Creating a UI Policy - ServiceNow Wiki


Hi,


You can use below Onload client script-


(1=New, Rest you can use as per your state value if required )



var s = g_form.getValue('state');


if(s != '1')


  {


  g_form.removeOption('state', '1');


}


else if (s == '1')


  {


  g_form.removeOption('state', '3');


  g_form.removeOption('state', '4');


 


}



Thankyou