Make entire field read only without using ACL's
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 06:17 PM
I would like to make an entire form read_only without using acl based on a role. I am choosing to find an alternative to acl based on the fact that individuals in this role could also have other roles that will still enable the to write on the form based on any other role they might have
My requirement is as below
I am a user with role, e.g, "project_manager", when I access projects to review, the project form should be read_only, so that I am not able to do anything besides read the project form
is there a way I can use business rule or even a client script to tackle this requirement.
Gracias Amigos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 06:27 PM
Hi @June Anderson ,
Hope you are doing well.
Yes it can be achieved without ACL using combination of client script and client callable script include.
But it will be difficult to manage the code if we are not using ACLs as there will be 50+ fields on the project form and we will need to write 50 lines to make the fields read only. Plus if any field already mandatory by other client script, UI policy or dictionary will give us hard time
Please mark this response as correct or helpful if it assisted you with your question.
Regards,
Harshal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 07:04 PM
hi
is it not going to cause issues with users who have other roles plus the project_manager role
and can you be a dear and help out with the acl. Though I am familiar with ACL's. this one is a bit complex for me
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 08:21 PM
you can use onLoad client script on that table and make all fields as readonly; but it won't work on list
function onLoad(){
if(g_user.hasRoleExactly('project_manager')){
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader