- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2021 01:17 AM
How can I hide fields based on role?
For example, I have a support team for which I don't want to show all the fields but managers can able to see all the fields. please help me out
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2021 01:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2021 01:21 AM
@Amit,
Then you need to write onLoad() client script:
EX:
function onLoad() {
//Type appropriate comment here, and begin script below
var roleInfo = [];
roleInfo[0] = g_user.hasRole('rolename');
if(roleInfo[0]=='true')
{
g_form.setDisplay('field_name',false);
}
Let me know if you stuck anywhere
Thanks
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2021 01:27 AM
it can be done in two ways.
1. onload client script to hide the fields based on role
2. creating different view and apply view rules
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2021 01:35 AM
Hi Amit,
Best to use read ACL to hide those fields based on role.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2021 03:35 AM
but if we have to hide more field then it would be lengthy. for every field we have to write acl.
can we do that from business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2021 03:50 AM
No, Business rule is for server side scripting.
Hiding a field is controlled by Client side so you can use either UI Policy script or Client script.
Client side code is already provided by many user but use setDisplay instead of setVisible.
function onLoad() {
if(g_user.hasRole("Mention the Manager role")) // Provide the role
{
g_form.setDisplay("Field name",true);
}
else
{
g_form.setDisplay("Field name",false); //
}
}