Hide Post and OneNote in Social Pane

By Dianna on 9/6/2015

This blog is an updated JavaScript on the one we wrote for Dynamics CRM 2013 and it is compatible with Dynamics CRM 2015. The JavaScript hides both tabs, Post & OneNote, in Dynamics CRM Social Pane. You can easily hide one of the two only, if required.

Add the below JS as new webresource, Type=JScript)

In the form you wish to hide Posts and OneNote, open Form Properties. In the Form Libraries add the webresource created before. In the Event Handlers>Form>OnLoad add a call to the function: HidePosts

If you need suport, submit the form on this page

 function HidePosts()
{
if(parent!=null && parent.parent!=null && parent!=undefined && parent.parent!=undefined)
{
var contentPanel=parent.parent.document.getElementById("crmContentPanel");
if(contentPanel!=null && contentPanel!=undefined)
{
var contentFrame=contentPanel.children.contentIFrame0.contentWindow;
if(contentFrame!=null && contentFrame!=undefined)
{
var controlEle=contentFrame.document.getElementById("header_notescontrol");
if(controlEle!=null && controlEle!=undefined&& controlEle.children!=null && controlEle.children.length>0)
{
for(var i=0;i<controlele.children.length;i++)
{
var ctrl=controlEle.children[i];
if(ctrl.title=="ONENOTE" || ctrl.title=="POSTS")
{
ctrl.style.display="none";
if(i+1<controlele.children.length)
{
controlEle.children[i+1].click();
}
else if(i-1>=0)
{
controlEle.children[i-1].click();
}
}
}
}
else
{
setTimeout(HidePosts, 1000);
}
}
}
}
}

---------------------------------------------------------------------------------------------------------------------

 

General
JavaScripts
Hide OneNote
Hide Post
Author