logo

NJP

Hiding specific emails from Activity

Import · Nov 15, 2019 · article

I got the requirement to hide only the 'Inactivity warning' emails from the Activity log for Incident. All other emails should be there in Activity.

I have performed the following step.

1. Created onLoad client script for INC to perform DOM manipulation.

function onLoad() {

//---------to hide 'Inactivity warning Activity' for UI 15

var x = document.getElementsByClassName("activity_header");

var s = document.getElementsByClassName("activity_data");

var s1 = document.getElementsByClassName("activity_spacer");

for(var i=0;i<x.length;i++)

{

if(x[i].innerHTML.indexOf("Inactivity Warning") > -1)

{

//alert('hello');

x[i].style.display = 'none';

s[i].style.display = 'none';

s1[i].style.display = 'none';

}

}

//---------to hide 'Inactivity warning Activity' for UI 16

var x1 = document.getElementsByClassName("h-card h-card_md h-card_comments");

for(var j=0;j<x1.length;j++)

{

if(x1[j].innerHTML.indexOf("Inactivity Warning for") > -1)

{

x1[j].style.display = 'none';

}

}

}

Extension for the above requirement can be.

1. If you don't want to allow specific user or groups to view particular emails then they can create the logic to check the user and use above code to hide the email.

*Tested on London and New York.

View original source

https://www.servicenow.com/community/now-platform-articles/hiding-specific-emails-from-activity/ta-p/2327266