The CreatorCon Call for Content is officially open! Get started here.

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

rossdrew
Tera Contributor

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);


}

}

2 REPLIES 2

Allen Andreas
Administrator
Administrator

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!

rossdrew
Tera Contributor

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