Can we hide a section on a form based on roles through ACL?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2019 10:07 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2019 10:12 PM
Hi Micky,
You can write a client script to acheive this
use the below code in the script
if(g_user.hasRole(''))// add the role
{
g_form.setSectionDispaly(' ',true/false); //add your section name
}
Regards
Ravindra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2019 10:12 PM
Hi Micky,
you can use onLoad client script and based on whether logged in user has role hide the section
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
‎02-11-2019 10:14 PM
Hello,
As of I know this can be possible by onLoad client script. You can write onLoad client script and based on required roles you can show/hide sections.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2019 08:49 AM
Try this on form load.
var sections = g_form.getSections();
if (g_user.hasRole('RoleName')) {
g_form.setSectionDisplay(sections[1], false);
}
else{
g_form.setSectionDisplay(sections[1], true);
}