How to make fields read only using Client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 10:51 PM
I am a newbie to Snow i wrtten client script on incident but fields are not getting read only:
function onLoad() {
//Type appropriate comment here, and begin script below
alert("testing");
g_form.setReadOnly('number', true);
g_form.setReadOnly('date_format', true);
}
- 49,861 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 10:54 PM
There might be another UI policies which take precedence over cs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 10:55 PM
Aaskash,
I dont think there is any other UI Policy since it is my own instance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 10:56 PM
Hi Shaik,
Please refer to the below thread
Make field read only with onload client script
http://wiki.servicenow.com/index.php?title=Make_Fields_Read-Only_Script#gsc.tab=0

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 10:57 PM
Hi Shaik,
You can use UI Policy to make fields Read Only and mark on load checkbox true. Here making Priority field Read Only on Incident form.
You can inactive your Client Script and try doing it through UI Policy.
Please mark Helpful or Correct as per impact of the response!!
Thanks,
Anjali