How to "Hide Chatter" by default everytime a user visits a page
4:23 PMUPDATE: With the Spring 2013 release, the steps described below have become bit more complicated.
The Show/Hide Chatter toggle sometimes might make the page look too long. When you have a lot of chatter going on, the page becomes really big and your detail page or the home page goes way down under.
Even when you can't control the size of your chatter frame, hiding it by default would be ideal i think. And so, this bit of code. Add this code to a home page component, to a visualforce page, or add it to a visualforce page and embed it within standard page layouts.
Use this, when you have chatter inside a visualforce page. Make sure that this code gets called after the entire page has loaded. Pasting this code towards the end of the visualforce page should be fine. In case it doesn't work, put the code inside a function and call the function after page load using "window.onload = functionname();"
var e = document.getElementById("showFeedLink");
if(e.style.display == "none")
chatter.getFeed().toggle('{"subjectId":"a4MV00000032ixk","feedType":"ENTITY"}', false);
The portion marked in RED denotes the record ID.Use this, when you want to hide chatter in the home page. Create a new Home Page Component and select "HTML Area" and then check the "Show HTML" checkbox and paste this code.
function hidechatter()
{
var e = document.getElementById("showFeedLink");
if(e.style.display == "none")
chatter.getFeed().toggle('{"subjectId":"a4MV00000032ixk","feedType":"NEWS"}', false);
}
window.setTimeout("hidechatter()", 2000);
}
The portion marked in RED denotes the USER ID.
8 comments
Thanks so much for this muah!
ReplyDeleteThis is not working post spring 2013.
ReplyDeletePlease suggest workaround
Updated the code.. please check
DeleteDoes not work.
Delete"numFeedItems":20 seems like a dynamic value.
Did you try setting random values for numFeedItems? have an alert statement after chatter.getFeed().toggle() function to know whether the function is getting called in the first place?
DeleteAlso, in which page are you trying to suppress chatter? Home Page or a record?
Thanks Edwin Vijay....This is working Now....You are awesome
DeleteOnly works with the correct / current userId and the numFeedItems.
ReplyDeleteWith no visible way of fetching these values on the fly, there seems to be no viable solution / workaround at this time.
try with the above code, you will have to pass the ID though at runtime
Delete