The CreatorCon Call for Content is officially open! Get started here.

Hide email client icon for non itil users

smarti37
Kilo Sage

Hi all ServiceNow guys,

I used the script mentioned on the wiki page to hide the email client icon for non itil user but I detected an undesired impact.


function onLoad()
{
removeEmailIcon();
function removeEmailIcon() {
var yesRole = g_user.hasRoles();
if (!yesRole) {
var refs = document.getElementsByTagName("a");
if (refs) {
for (var i=0; i < refs.length; i++) {
var ref = refs<i>;
var inner = ref.innerHTML;
if (inner.indexOf("email.gifx") > 0){
ref.style.display = 'none';
}
}
}
}
}
}


On my task form, i add a custom glide_list field named "Additional contact" equivalent with the "Watch List" field but used only for non itil user. This field have also the same icon named "email.gifx" as the email client.
I you understand the problem ... the script used to hide the email client icon, hide the email icon of the "additional contact" field too.

Do you have an idea to avoid this problem ?

Regards,
Smarti37.
10 REPLIES 10

That's prototype javascript syntax to identify the email client icon and hide it.