Tuesday, July 31, 2012

MSCRM 4.0 Remove new record

Microsoft Dynamics CRM 4.0 Removing new record button from the standard Tool Bar.
It is unsupported!
1) Go to the web site server
2) Open {MSCRM folder}/_root/bar_Top.aspx with any text editor
3) Find first script tag
It should look like this:

<script type="text/javascript">

function DownloadClient()
{
var sUrl = "/_root/ClientInstaller.exe";
var oFrame = window.document.frames.frmDownloadOlk;
if(IsNull(oFrame))
{
oFrame = window.document.createElement("<iframe style='display:none' id='frmDownloadOlk' src='" + prependOrgName("/_root/Blank.aspx") + "'></iframe>");
oFrame = window.document.body.insertBefore(oFrame);

window.setTimeout("window.document.frames.frmDownloadOlk.location = \"" + sUrl + "\"", 10);
}
else
{
oFrame.location = sUrl;
}
}
function DisableAddinDownload() {
if (!IsNull(document.getElementById("btn_download_olk")))
{
document.getElementById("btn_download_olk").style.visibility = "hidden";
}
}

</script>
<!--[if MSCRMClient]>
<script  type="text/javascript">
window.attachEvent( "onload", DisableAddinDownload);
</script>

4) Add RemoveNewRecord to the script
function RemoveNewRecord(){
if (!IsNull(document.getElementById("mnu_new_record")))
{
document.getElementById("mnu_new_record").style.display = "none";
}
}

5) Add window.attachEvent( "onload", RemoveNewRecord); to the script

The script should look like this:
<script type="text/javascript">
function DownloadClient()
{
var sUrl = "/_root/ClientInstaller.exe";
var oFrame = window.document.frames.frmDownloadOlk;
if(IsNull(oFrame))
{
oFrame = window.document.createElement("<iframe style='display:none' id='frmDownloadOlk' src='" + prependOrgName("/_root/Blank.aspx") + "'></iframe>");
oFrame = window.document.body.insertBefore(oFrame);

window.setTimeout("window.document.frames.frmDownloadOlk.location = \"" + sUrl + "\"", 10);
}
else
{
oFrame.location = sUrl;
}
}
function DisableAddinDownload() {
if (!IsNull(document.getElementById("btn_download_olk")))
{
document.getElementById("btn_download_olk").style.visibility = "hidden";
}
}

function RemoveNewRecord(){
if (!IsNull(document.getElementById("mnu_new_record")))
{
document.getElementById("mnu_new_record").style.display = "none";
}
}
</script>
<!--[if MSCRMClient]>
<script  type="text/javascript">
window.attachEvent( "onload", DisableAddinDownload);
window.attachEvent( "onload", RemoveNewRecord);
</script>

Save and open your MSCRM.

The result should look like:

Thanks for
http://blogs.msdn.com/b/rextang/archive/2008/08/28/8900674.aspx

No comments:

Post a Comment