Make field readonly using UI Action

DevYadav
Tera Contributor

Hi Community,
I’m trying to add a button on the Incident table form that, when clicked, should make the State and Short Description fields read-only. Could anyone guide me on how to achieve this?

Thanks in advance!

9 REPLIES 9

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @DevYadav 

Is there any specific reason to implement this using a UI Action? It might be better to handle it via a UI Policy, based on the state and other parameters."

 

*************************************************************************************************************
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]

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

@Dr Atul G- LNG 

Thank you for the response. However, the requirement is that both fields should become read-only only when the button is clicked.

https://www.servicenow.com/community/developer-forum/setting-fields-to-read-only-in-ui-action/m-p/15...

 

https://www.servicenow.com/community/developer-forum/how-to-make-a-field-read-only-using-ui-action/m...

 

*************************************************************************************************************
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]

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

Edward Rosario
Mega Sage
Mega Sage

Adding a button for this is overkill and not aligned with best practices in ServiceNow. You don’t need a button to control field visibility or read-only behavior—this is exactly what UI Policies are for. Buttons should be used for actions (like triggering scripts or flows), not for simple client-side UI manipulations.

  • Navigate to:
    System UI > UI Policies
    (Table: Incident [incident])

  • Click “New” and configure:

    • Name: Make State and Short Description Read-Only

    • Table: Incident

    • Conditions:
      Set the condition that should trigger the read-only behavior.
      (Example: State is “Resolved” or Assignment Group is “Network” — whatever your use case is.)

  • Check:
    Reverse if false (optional—if you want the fields to go back to editable when the condition no longer applies)

  • Save the UI Policy.

  • Under the UI Policy record, go to the UI Policy Actions related list:

    • Click New for each field you want to affect:

      • Field name: State
        Make Read-Only: True

      • Field name: Short Description
        Make Read-Only: True

  • Save everything.