Make all fields on a form editable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2022 08:10 AM
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);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2022 08:19 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2022 08:22 AM
Do I need to list every field using this script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2022 08:23 AM
What about the role? The fields are only editable for a particular role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2022 08:53 AM
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.