Hide email client icon for non itil users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2011 08:47 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2011 09:03 AM
Try this instead...
if(!g_user.hasRoles()){
$('email_client_open').hide();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2011 12:28 AM
mark.stanger
Excellent Mark ! Only 2 javascript lines to give 100% satisfaction 🙂
Great Last Day Of The Week for Me 🙂
Thank you so much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2015 10:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2015 04:55 AM
Hi Mark,
I also looked at the Chrome Developer Console and saw the following.
[00:00:00.000] onLoad Modify Comments Label
js_includes_doctype.jsx?v=09-01-2015_1202&lp=Wed_Sep_09_20_45_04_PDT_2015&c=6_248:748 ***************************************************
js_includes_doctype.jsx?v=09-01-2015_1202&lp=Wed_Sep_09_20_45_04_PDT_2015&c=6_248:748 A script has encountered an error in render events
js_includes_doctype.jsx?v=09-01-2015_1202&lp=Wed_Sep_09_20_45_04_PDT_2015&c=6_248:748 TypeError: $ is not a function
js_includes_doctype.jsx?v=09-01-2015_1202&lp=Wed_Sep_09_20_45_04_PDT_2015&c=6_248:748 Script ends. Continuing happily
js_includes_doctype.jsx?v=09-01-2015_1202&lp=Wed_Sep_09_20_45_04_PDT_2015&c=6_248:748 ***************************************************
js_includes_doctype.jsx?v=09-01-2015_1202&lp=Wed_Sep_09_20_45_04_PDT_2015&c=6_248:748 [00:00:00.002] Hide Mail Icon
js_includes_doctype.jsx?v=09-01-2015_1202&lp=Wed_Sep_09_20_45_04_PDT_2015&c=6_248:748 [00:00:00.006] ui_policy loaded