Make all fields on a form editable

paradise624
Tera Contributor

Hi,

I have a requirement to make all fields editable on a form if the user has a particular role. What's the best way to do this? I have written this scripts but not sure if this is the best way or the correct way..

 

 

if (g_user.hasRoleExactly('problem_manager) {
g_form.setReadOnly ('category' false);

g_form.setReadOnly (description' false);

}

4 REPLIES 4

sujata sakhare
Tera Contributor

hi,

Use following method for all fields on a form editable.

Try it.

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

 Thanks.

Do I need to list every field using this script?

What about the role? The fields are only editable for a particular role

GodOfWar
Mega Guru

The fastest way to do that is configure the ACLs for a specific role. Other than that would UI Policies.

 

Mark helpful if this helps.