- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2014 08:22 AM
I need to be able to toggle the read only flags at the field level conditionally based on business logic. I tried taking the approach of using the dictionary entries to set every "read only" option to "true", and then override it on the client side with setReadOnly(fieldname, false), only to find it didn't work.
I then went to the sandbox to make sure it wasn't something in the my code, and I observed the same thing. Furthermore, it seems the UI Policies aren't able to override it either.
I take it this is expected behavior? I saw something on servicenowguru about dictionary entries causing problems, but it didn't go into specifics (that I saw).
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2014 09:37 AM
The setReadOnly operates only on the DOM in the client script, and cannot override the dictionary setting. You probably do not want to be messing with the dictionary's read only setting with ANY script.
You can use setReadOnly to manipulate form elements to read only or editable on the fly in your client script on a form. But UI Policies is a better way to handle field protection based on business logic.
And then, always check to see if things that you don't want editable can still be edited in list view.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2014 09:37 AM
The setReadOnly operates only on the DOM in the client script, and cannot override the dictionary setting. You probably do not want to be messing with the dictionary's read only setting with ANY script.
You can use setReadOnly to manipulate form elements to read only or editable on the fly in your client script on a form. But UI Policies is a better way to handle field protection based on business logic.
And then, always check to see if things that you don't want editable can still be edited in list view.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2014 09:45 AM
That mostly clarifies things for me.
I was under the impression the UI policy is a client side script? My testing also showed that UI policies, using scripting or otherwise, can not override the dictionary read only setting anyhow.
I'm aware of the list view problem, thanks. My rule of thumb is to make a list read only when it's "normal" users who are going to be using it.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2014 11:40 AM
Yes, UI policies are client side. They can be converted to data policies, but I haven't experimented with that.