Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Field should be editable for change manager only

anilkumarsharma
Giga Guru

HI Team,

Requirement : I have created one filed Implemneted without approval     on change form . this Fied Should be editable only for change manager when change status is Complete.


Point-1: I have made the filed read only from dictionary

Point 2 : I have written the UI policy which is mention bellow but it is not working

Condition:   Status   is Completed

Execute if True :

function onCondition() {

if (g_user.hasRole('change_manager'))  

          {  

          g_form.setReadonly('u_implemneted_without_approval',false);  

    }  

}  

Execute if False:

function onCondition() {

g_form.setReadonly('u_implemneted_without_approval',true);  

}

Pls. help

7 REPLIES 7

russell_miller
Kilo Guru

I would remove the readonly on the dictionary entry and use a write ACL for role control and UI policy for the conditional state control.



R


bernyalvarado
Mega Sage

Hi Anil, be aware that making a field read only on dictionary is almost like doing the variable a constant the one cannot be changed. In other words, you will not be able to set it to editable while it's a read only field on dictionary.



I hope this is helpful!



Thanks,


Berny


bernyalvarado
Mega Sage

as for the recommended methods to do what you want to accomplish, these are:



a) ACL: Create a write ACL using your table.field on which status is completed and on the role related list you set the Change Manager role. Simple as that !



b) Through client script. doing something similar to what you show above, perhaps on an OnChange of the status field.



Thanks,


Berny