How can i hide fields based on user and role?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2018 02:52 AM
In my custom table have two fields
1.Manager Name
2.Mobile phone
When ever i am Impersonate to User Kasi Rao with Admin role on custom table above two fields will be displayed.
My requirement is like this
When ever i am Impersonate to User Karthik Reddy with Custom role .I want hide two field.
Is it possible to hide fields based on Impersonate User?
If possible please help me.
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2018 03:07 AM
HI Kataru kasi rao
Kindly Open Form > right click on header > Configure > Client script > New
Fill fields, Type > Onload
script
function onLoad() {
if(g_user.hasRole('mentionrolename')
{
g_form.setVisible('Fieldname',false); // hide that field
or
g_form.setDisplay('Fieldname',false); //hide field
}
}
Thanks,
Aravind
Please mark answer as Correct, helpful as appropriate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2018 04:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2018 05:21 AM
function onLoad()
{
var role_check = g_user.hasRole('Mention the Role Name');
if(role_check == 'admin')
{
g_form.setDisplay('Field Name', false); //Hide field
}
else if(role_check == 'Mention your Custom Role')
{
g_form.setDisplay('Field Name', true); //hide field
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2018 07:19 AM
Hello Naveen
Here Manager Name field is Reference.
I have going through g_form.getReference() with call back function but it's not working.
can you please help me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2018 07:36 AM
Hi,
Just create a read ACL for those fields and you're done.
Regards
Greg