12 May 2010

Remove Advanced Find

I was recently asked if it is possible to remove Advanced Find from the user interface. My initial answer was: no and there's no need as a user can only search on data that they are allowed to. This didn't cut it as with Advanced Find it's possible to add columns which the users aren't supposed to see. There were some other details which I won't go into, suffice to say it had to go!

The following example will remove the advanced find but, it by an UNSUPPORTED METHOD, use it at your own risk!

This change involves adding some JavaScript to loader.aspx, before continuing make sure that it's been backed up first.

1. Open loader.aspx in a text editor of your choice.

2. Add the following JavaScript function just before the tag.

<script language="JavaScript" type="text/javascript">
function HideAdvancedFind()
{
//Check whether the iframe is completely loaded or not
if(document.getElementById("stage").readyState != "" && document.getElementById("stage").readyState!="loading")
{
try
{
document.frames[0].document.getElementById("btn_advfind").style.display="none";
document.frames[0].document.getElementById("_MIopenAdvFind").style.display="none";
}
catch(e)
{
}
}
}
</script>


3. Locate the frame named "menuBar" and just before the end of the tag add:

onreadystatechange="Javascript: HideAdvancedFind()"


4. Save and close loader.aspx and fire up CRM. The Advanced Find button has been removed from the menu-bar and the Tools menu.
Note: An IISReset may be necessary to clear the cache.

The finished result:




1 comment:

  1. Thx for this :D I have to hide the advanced find button for certain roles and this is a nice base to build on :) Thx again :)

    ReplyDelete