Make all fields read-only client script solution

keshav77
Tera Contributor

* Recently some of the developer asking  how to make all fields read-only for a particular form and  at a particular state.

 

Here is the one of the example of it make incident form fields read-only when the state is Canceled

 

 

 

keshav77_0-1739263309316.png

 

  In this script we are trying get value of the state of the incident form if the state value is 'Canceled'(label) name is 8 or backed value is 8 of that. then getEditableFields() method is needed be used to retrieve a get all fields on a form that are currently editable, After that you need to run the loop to make these fields read only on the above condition.

I hope this helpful . Please mark correct/helpful based on impact

 

 

1 REPLY 1

Dr Atul G- LNG
Tera Patron
Tera Patron

 @keshav77 

 

You can use the UI policy which is No code in this case.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************