Hide Related List for all users except admin

Dev321
Tera Contributor

I would like to hide the related list for all users that are not an admin. Is this one with a client script of UI policy?

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@Dev321 

you can use onLoad client script and hide the related list

Hiding Related Lists and Embedded Lists 

function onLoad(){

	// if not admin
	if(!g_user.hasRoleExactly('admin'))
		g_form.hideRelatedList('task_ci'); // give the correct name of related list

}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader