Set all fields to read only when active = false without affecting related list edit button

Emma Angarita
Tera Expert

Hi all, I have a custom app that I am trying to set all fields on the form as ready only when the ticket is closed - ie. active = false. This is successful using a write ACL with the condition of active = true: 

 

EmmaAngarita_2-1668559498344.png

 

But, when this condition is set on the ACL, the edit button on the related list tab of the same table disappears for the 'user' role, and is only visible for admins. I have checked and confirmed that the omit edit button is not checked for this list control, and there is no impact to the new button if the ACL condition is or is not there. When the ACL condition of active = true is removed, the edit button is visible again, but of course all fields are editable even when the ticket is inactive.  

 

 

EmmaAngarita_1-1668559412138.png

 

EmmaAngarita_3-1668559523091.png

 

How do I achieve both, as one cancels out the other? 

- set all form fields to read only when ticket is inactive 

- enable edit button on related list 

 

Many thanks 

7 REPLIES 7

Community Alums
Not applicable

Hello Emma,

Seems like a problem since NewYork version and the recommendation from SN based on the KB0813148 is not working for variables on the Form. Were you able to solve this issue? 

Hi Lubos, I was able to solve it but had to use ACL's, the client script didn't work in my case. 

Alex150
Mega Sage

Hi Emma,

Please use following code to make all fields read-only(Client Script)

 var fields = g_form.getEditableFields();
        for (var x = 0; x < fields.length; x++) {
               g_form.setReadOnly(fields[x], true);
           }

Regarding the Edit button make sure users have required role you chosen in ACL. Also find out if other ACLs not overwrites this rule.