How to make a field readonly when certain field value changes from the oldvalue ?

ABHI08
Tera Contributor

Need to make a field readonly when the value changes for the first time to avoid multiple changes

7 REPLIES 7

Rafael Batistot
Tera Sage

Hi @ABHI08 

 

You need combination, server side with client side 

 

1 - Business Rule (Server-side)

 


Create a Business Rule to detect first-time change:

  • Table: your target table (e.g., incident)
  • When: before
  • Update: (checked)
  • Condition: Leave blank or add any condition you want

if (!current.u_priority_changed && current.priority.changes()) {
current.u_priority_changed = true;
}

 

2 - UI Policy to Make Field Read-Only (Client Side)

 

Create a UI Policy to make the short_description (example field) read-only when the flag is true:

  • Table: your target table (e.g., incident)
  • Conditions:
    • u_priority_changed is true
  • In the UI Policy Actions:
    • Field: short_description
    • Read-only: (checked)

 

Ankur Bawiskar
Tera Patron
Tera Patron

@ABHI08 

What's your actual business requirement here?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar I want to make a field read only after after the field value have been changed once. The read-only part is only to avoid any further changes to the field value after the 1st time change

@ABHI08 

1st time change for new record or existing record?

What's your actual business requirement?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader