Sunday, 15 September 2013

Hide Recycle Bin from Home Page Layout 

 Salesforce doesn't provide specifications to remove Recycle Bin from Home Page.But there are situations which demands that the Recycle Bin shouldn't be shown over the Home Page. In such adverse situations JavaScript is our Best Friend.


First Let me tell you about this Dustbin of Salesforce.

The Recycle Bin link in the sidebar lets you view and restore recently deleted records for 15 days before they are permanently deleted.

Follow the following steps to Hide the Recycle Bin.
 

Click on Name > Setup > Customize > Home > Home Page Components.
Click on New to add a New Custom Component. 

Make sure that you have checked WIDE COMPONENT and SHOW HTML Checkbox. 

 

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">
</script>
<span id="hideMyParentsp">
</span>
<script>
$(document).ready(function() {  $('#sidebarDiv #hideMyParentsp').parent().parent().hide();      });
</script>

<script type="text/javascript">
window.onload = function(){
var x=document.getElementsByTagName("img");
for(var i=0;i<x.length;i++) {
  if(x[i].title=='Recycle Bin')  {
     var dtag = x[i].parentNode.parentNode.parentNode; dtag.style.visibility='hidden';
      }
 }
var xx=document.getElementsByTagName("span");
for(var ii=0;ii<xx.length;ii++) {
  if(xx[ii].innerHTML=='Recycle Bin')  {
 xx[ii].style.display='none';
  }
 }
 };
 </script>
 
 
 

 Click on Save.

Next we need to add this component on Home Page Layout.For this Follow the following Steps
   
    Click on Name > Setup > Customize > Home > Home Page Layout.

 

Select "Edit" for your Layout from which you want to remove Recycle Bin.
    Check the Component which you just created in Wide Column Display , Click Next

 

Click Save , Additionally you can see the preview.


  You can see the changes in your Home Page. Recycle Bin is No More. You can say that his soul is with us [as it is just hidden] but his body left the mortal world.