How to make Readonly to True/False Field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2014 02:32 AM
Hi,
I am trying to make readonly from client script but still it can be edit. Can anybody give idea how we can do that?
I am using.. g_form.setReadonly('<Filed_name>',true);
We can make string filed to readonly easily but some difficulties in true/false filed. Suggest any idea.
- Labels:
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2014 05:13 AM
Hi Mukesh,
Can you please explain what is the exact requirement so that we can come up with best solution.
Thanks
Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2014 02:58 AM
Hi Mukesh,
I am guessing that you might have written multiple codes for the same field eg: g_form.setReadOnly('test', true) and in some other client script g_form.setReadOnly('test',false) or maybe multiple UI policy actions like this.
You can turn on the debug option and see what is exactly happening to your field.
Hope this helps..
Regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2014 06:19 AM
I also think that what Vijayan has said is correct.
You might have some other Client scripts or UI policy that is setting this field as Read Only False.
You might need to revisit that CS or UIP.
If it is absolutely necessary to retain that part of the code in a CS to be retained, you should change the Order in which these 2 scripts execute

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2014 06:58 AM
Mukesh,
Take a quick look at the following wiki article: Differences Among Scripts - ServiceNow Enterprise Wiki . I think you need to understand this before choosing how you make fields readonly.
Workflow will not make use of client side JS and is not what you're looking for. Typically, you want to do this with ACLs (secures it on the server side) or UI policies (client side). I don't often need to do us using a client script.