Make field read only to everyone and editable for 'user_admin' role

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 03:12 AM
Hi Community,
I have created a new field 'termination date' in user table. I have a requirement to make this field read-only for itil user and editable for 'user_admin' role through ACL.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 04:10 AM
Then ACLs might be conflicting , please create onload client as suggested by
Regards
Regards,
Musab

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 03:20 AM
Hi,
Create a field level ACL for this on the user table.
Write ACL
User.termination_date
Add role (user_admin)
Mark this as Helpful/Correct, if Applicable.
Regards,
Sourabh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 03:36 AM
Hi Sourabh,
I have tried the same earlier but it's not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 03:53 AM
Hi,
So did you perform ACL debugging?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 05:10 AM
Don't use any ACL
you can simply use onLoad client script and no BR is required
function onLoad() {
if (g_user.hasRoleExactly('itil')){
g_form.setReadOnly('termination_date', true);
}
else if(g_user.hasRoleExactly('user_admin')){
g_form.setReadOnly('termination_date', false);
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader