- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2016 03:26 PM
function onLoad() {
//Type appropriate comment here, and begin script below
if(g_user.hasRole('u_pm_tracking_user'))
{
g_form.setDisplay('u_rate',false);
g_form.setDisplay('u_project_sow',false);
g_form.setSectionDisplay('january (next year)', false);
g_form.setSectionDisplay('february', false);
return false;
}
Hi,
I need to hide above fields depending on the role, which is working well. But, wanted to display all fields if role is not equal to 'u_pm_tracking_user'. Please, someone help me out with this.
Thanks,
Manoj.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2016 04:48 PM
As an admin you automatically assume ALL roles. Try the following condition:
function onLoad() {
if (g_user.hasRole('u_pm_tracking_user') && !g_user.hasRole('admin')) {
g_form.setDisplay('u_rate',false);
g_form.setDisplay('u_project_sow',false);
g_form.setSectionDisplay('january (next year)', false);
g_form.setSectionDisplay('february', false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2016 03:47 PM
Your code should work. Are you testing as an admin? Admins inherit all roles by default so these fields would be hidden.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2016 04:25 PM
This is working well on different user. But as an admin, I need to see all fields. Client script is applying to me as well, those fields need to be displayed to me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2016 04:48 PM
As an admin you automatically assume ALL roles. Try the following condition:
function onLoad() {
if (g_user.hasRole('u_pm_tracking_user') && !g_user.hasRole('admin')) {
g_form.setDisplay('u_rate',false);
g_form.setDisplay('u_project_sow',false);
g_form.setSectionDisplay('january (next year)', false);
g_form.setSectionDisplay('february', false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2016 05:02 PM
