Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Difference between setReadonly() and setDisabled() in Client Script.

Shikha Kumari
Tera Contributor

I have gone through many such articles stating the exact difference between the both functions , but hardly able to get the proper difference , please share some good idea which could clarify the concerns.

 

 

Regards.

Shikha 

6 REPLIES 6

Sagar Pagar
Tera Patron

Hi Shikha,

 

  • SetReadonly is used to make the field read-only if true. Makes the field editable if false.
  • SetDisabled is used to make field gray out and unavailable.

 

  • Note: Both setReadOnly and setReadonly are functional.

        Use UI Policy instead of this method.

 

Regards,

Sagar Pagar

The world works with ServiceNow

What is the greyout and unavailable I have confusion.can you please clarify?

Hi Shikha,

 

Please refer the old thread: What is difference between setReadOnly() and setDisabled() function?

 

Regards,

Sagar Pagar

The world works with ServiceNow

Ankur Bawiskar
Tera Patron

Hi,

what's your business requirement here?

Regards
Ankur

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