Show/Hide tabs based on Roles

sk56
Tera Contributor

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

2 REPLIES 2

Anil Lande
Kilo Patron

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

MR1
Tera Contributor

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