Monday, February 24, 2014

Hide Unwanted Activities from Activities view Dropdown in MSCRM2011/ MSCRM2013 /MSCRM2015 using javascript

Create a JavaScript web resource with following functions.
 
function AttachHideEvent()
{
    document.getElementById("crmGrid_SavedNewQuerySelector").setAttribute('onclick','HideItems();');
 
    $( "#crmGrid_SavedNewQuerySelector" ).mouseout(function() { HideItems(); });
 
}
 
function HideItems()
{
    if(document.getElementById("ViewSelector_fax") !=null)
    {
        //fax
        document.getElementById("ViewSelector_fax").style.visibility = "hidden";
        document.getElementById("ViewSelector_fax").style.height="0px";
        document.getElementById("ViewSelector_fax").style.float="left";
        //Letter
        document.getElementById("ViewSelector_letter").style.visibility = "hidden";
        document.getElementById("ViewSelector_letter").style.height="0px";
        document.getElementById("ViewSelector_letter").style.float="left";
    }
}
 
 
Then add a enable rule to first button on activities homepage ribbon and call this function with default value = true/ function name= AttachHideEvent/ webresource=web resource created.
 
In 2nd function add activities you want to hide from dropdown.
 

3 comments:

Lingam said...

I tried to hide the activities from the activity list which has been posted by you.

But the script is not firing on load of activity home page. Can you please guide me how to hide the system activities from the view list.

Unknown said...

did you add the event via "Ribbon Workbench 2013"?? after creating a Enable Rule there is no option to insert a javascript there..

Unknown said...

after creating the Enable Rule I can't attach any .JS
I am using Dynamics CRM 2013 and Ribbon Workbench 2013