All variables except one read only on catalog items
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2018 11:30 AM
We've used the script below to set all fields read only for Catalog Task and Requested Items. However, we need one variable to be editable and all others read only.
the variable is "customer_phone" that we need to NOT be read only. Normally how I've done catalog items in the past is to put on UI Policies for them and not through a client script. However, here it was done with a client script.
function onLoad() {
g_form.setVariablesReadOnly(true);
}
any idea on something simple that I could add to this script to set all of them read only except for the customer_phone field?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2018 12:49 PM
Why do you have to use a client script? I had to re-read through your post a few times to see if it made sense or mentioned a reason for it, but it doesn't seem like there's a NEED to do it, just that someone set up something and you just want to do that? lol...
I would just go with the UI Policy.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2018 12:52 PM
The catalog item is already built, and the client script was already added in by the other developer. I wanted to see if there was an easy way to just update the client script for it. if it's my choice, I use a UI Policy not the client script. Which I may end up having to do anyhow just because it's easier.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2018 12:53 PM
in a perfect world they should have catalog ui policies applying to both the request and the forms (item and task) and just configure it correctly. however if they are on an old instance its likely this is just a client script that exists that then doesnt have the same need.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2018 12:57 PM
Yeah, I know right! Haha. Makes sense though if it's an old instance. Doesn't seem like that's the case here, but good to know about the possible limitation of a user's environment.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2018 01:02 PM
I believe(i just started with this company a few weeks ago) the reason it was done with client script was because ALL the fields needed to be read only and there was only one developer here so to speed things up he used that client script to set them all to read only. Personally, I've ALWAYS used UI Policies to accomplish this, which is why I was asking if there was a script that could easily be used or a line of code added to the current. The best solution would probably be to just deactivate the client script and put UI Policies in place. Thanks for the feedback.