How to make a variable read only on a record producer after closing the incident

sath
Tera Expert

Hi,

 

We need to make a variable on a record producer read only. It will be editable after incident is submitted, but should be read only for incident is closed. Please assist.

1 ACCEPTED SOLUTION

When the form is saved, it reloads, so you also need a similar onLoad Client Script.

View solution in original post

8 REPLIES 8

When the form is saved, it reloads, so you also need a similar onLoad Client Script.

I have removed isLoading condition from onChange script, its working now. Thank you.

Voona Rohila
Kilo Patron
Kilo Patron

Hi @sath 

You can use below syntax in your client script to make variable read-only

 

 g_form.setReadOnly('variables.variablename',true); //replace variablename

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Hi @Voona Rohila 

With the above script, when I change incident state to resolved, the field is being set to read only, but it becomes editable once i save the form.