Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Hide tabs with roles in Workspace

sieusaopolo15
Giga Sage

I want to hide these tabs in Workspace if users don't have specific roles. How can I do it in ?

 

sieusaopolo15_0-1726115473507.png

 

2 REPLIES 2

Community Alums
Not applicable

Hi @sieusaopolo15 ,

These are Related lists on the record.

If you want to hide those , then you can use a UI Policy, Now in Script section check Run Scripts button make it "Run scripts in UI type" All in which add a below code in Execute if True Script Editor

 

UI Policy sample Script:

//execute if true
function onCondition() {
	if (g_user.hasRole('cat_man')) {
		g_form.showRelatedList('REL:dfb2edae1b50e51069fecddf034bcbc7');	
	}


//execute if false
function onCondition() {
g_form.hideRelatedList('REL:dfb2edae1b50e51069fecddf034bcbc7');
}

 

If it's not working on workspace view, the you can add additional line of code "

if (view == 'workspace'){  

 

Hi @Community Alums ,

I tried your suggestions but it is not working, It seems like this is not related list