Show/Hide tabs based on Roles
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2022 05:34 PM
Hi,
I tried to accomplish the requirement to show or hide the multiple tabs on the Hardware table based on roles.
Initially, I tried with UI policy script then later with Onload client script. However, both of them didn't work.
Thanks
Labels:
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2022 06:52 PM
Hi,
Can you please share what you have done?
Pleas share the script and make sure you make all fields mandatory false when hiding section. If any field is mandatory then section will not be hiddedn.
Thanks,
Anil Lande
Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande
Thanks
Anil Lande
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 07:58 AM
UI Policy script
Below UI Policy script is working fine
function onCondition(){
if(g_user.hasRole('asset_desk')){
g_form.setSectionDisplay('general',true);
}
else{
g_form.setSectionDisplay('general',false);
}
}
But I would like to add model category(model_category.category_type) condition from cmdb_model_category. table.
So tabs should be visible based on role and model cateory type
Something like this
var gr = g_form.getReference('model_category');
if(g_user.hasRole('asset_edit') && gr.category_type == 'desk'){
g_form.setSectionDisplay('alotment',true);
}
else{
g_form.setSectionDisplay('alotment',false);
}
}
Thanks