Client script: make all editable fields read only under certain conditions

A write ACL is the ideal solution, but if for some reason this logic had to happen in a client script here is an (undocumented) solution:

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

Seems to have left the worknotes editable on the form I tried it on which could be quite neat if that is the only field that should be editable. will not work on mandatory fields if these are empty


Popular posts from this blog

GlideRecord setValue

URL link in addInfoMessage