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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 04:41 PM - edited 11-15-2022 04:45 PM
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:
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.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 07:09 PM - edited 11-15-2022 07:10 PM
Hello
The reason why edit button disappears isnbeacuse you have written a write Acl.Had you written a create ACL the new button woukd have disappeared.
Now for making the fields readonly create on onload client script with the below code:-
if(g_form.getValue('active')=='false')
{
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}
}
Please mark my answer as correct based on Impact.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 10:12 PM - edited 11-15-2022 10:18 PM
Thanks for the response, unfortunately this didn't work - fields are still editable. I modified the script slightly ( == false instead of == 'false' - this worked, but then I received the following errors:
function onLoad() {
if (g_form.getValue('active') == false) {
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2022 01:12 AM
Is this a scoped table? Are all the fields in the same scoped application as the scoped table? Did you write the script in the same applicatuon. Isther any other field which is from different apllocation than the table or the script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2022 04:36 PM
Is this a scoped table?
- yes, it extends task table
Are all the fields in the same scoped application as the scoped table?
- no, it extends the task table, so many fields are part of task table
Did you write the script in the same application.
- yes, it is written in the same scope as the form it refers to - ie. the scoped app, not global for task
Is there any other field which is from different application than the table or the script?
- yes, from task table