Setting State field to read only when state is New or Assess

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2018 12:03 PM
I am trying to set the state field on the change request to be read only when the state is New (list value of -5) or Assess (list value of -4). I have tried doing it through a UI policy and then a client script; neither worked. I checked for ACLs that would conflict and nothing stands out. I do not see any client scripts that might be a problem either.
I set the UI Policy conditions as follows:
Short Description = Change: Read only - State
Approval is one of Not Yet Requested / Requested
or On hold is true
OR
State is one of New / Assess
Type is not Emergency
Client script I used after deactivating the UI Policy is:
function onLoad()
{
var state = g_form.getValue('state');
if (state == '-5' || state == '-4'){
g_form.setReadonly('state',true);
}
else {
g_form.setReadonly('state',false);
}
}
- Labels:
-
Change Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2018 12:06 PM
For your client script, remove the ' ' around the -5 and -4
Please mark reply as Helpful/Correct, if applicable. Thanks
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
‎07-20-2018 12:55 PM
I did not have the quotes in originally, but added them as chance....I took them out and still the script still does not work