<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Hide tab in any entity form in Microsoft Dynamics CRM 4 using Javascript in onLoad event of the form.</title>
	<atom:link href="http://www.mohamedibrahim.net/blog/2010/03/03/hide-tab-in-any-entity-form-in-microsoft-dynamics-crm-4-using-javascript-in-onload-event-of-the-form/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mohamedibrahim.net/blog/2010/03/03/hide-tab-in-any-entity-form-in-microsoft-dynamics-crm-4-using-javascript-in-onload-event-of-the-form/</link>
	<description>Technical issues, problems, errors, findings &#38; resolutions covering Microsoft Dynamics CRM, software development, Microsoft .NET, C#, VB.NET, Commerce Server, Integration, E-Commerce, Scribe, Online shops and more general technology and consultancy posts.</description>
	<lastBuildDate>Mon, 21 Nov 2011 20:27:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Mark</title>
		<link>http://www.mohamedibrahim.net/blog/2010/03/03/hide-tab-in-any-entity-form-in-microsoft-dynamics-crm-4-using-javascript-in-onload-event-of-the-form/comment-page-1/#comment-845</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Thu, 20 May 2010 21:46:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.mohamedibrahim.net/blog/?p=177#comment-845</guid>
		<description>Hello Maxjerin,

I&#039;m administering a small on-premise CRM 4.0 deployment and have tried to use your scripts. I am able to get the HideTab(&#039;administration&#039;) script working because of how easy it is however the latter conditional hide (primarycontactid) script is not quite what I need it to be.

I am trying to hide a tab within Opportunities based on an assigned Security Role. I was going to repurpose the latter script using the RoleID from within _MSCRM.RoleBase however my javascripting skills just aren&#039;t up to par.

Do you have any suggestions for an OnLoad script that would accomplish that Security Role based tab hide within Opportunities? Any help would be great!

Thanks!!</description>
		<content:encoded><![CDATA[<p>Hello Maxjerin,</p>
<p>I&#8217;m administering a small on-premise CRM 4.0 deployment and have tried to use your scripts. I am able to get the HideTab(&#8216;administration&#8217;) script working because of how easy it is however the latter conditional hide (primarycontactid) script is not quite what I need it to be.</p>
<p>I am trying to hide a tab within Opportunities based on an assigned Security Role. I was going to repurpose the latter script using the RoleID from within _MSCRM.RoleBase however my javascripting skills just aren&#8217;t up to par.</p>
<p>Do you have any suggestions for an OnLoad script that would accomplish that Security Role based tab hide within Opportunities? Any help would be great!</p>
<p>Thanks!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maxjerin</title>
		<link>http://www.mohamedibrahim.net/blog/2010/03/03/hide-tab-in-any-entity-form-in-microsoft-dynamics-crm-4-using-javascript-in-onload-event-of-the-form/comment-page-1/#comment-835</link>
		<dc:creator>maxjerin</dc:creator>
		<pubDate>Wed, 07 Apr 2010 08:12:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.mohamedibrahim.net/blog/?p=177#comment-835</guid>
		<description>Here is the code that I used to HIDE/UNHIDE a tab when I wanted to show it for only one particular user and hide for others. The code includes some alert messages just for debugging purpose which you might find useful to understand the code. You may remove them once done.

This section goes into the onChange section of the Primary Contact lookup field

if (crmForm.all.primarycontactid.DataValue == null )
{
    var strTabStatus = TabStatus(&#039;Profile&#039;);
    if ( strTabStatus == &#039;&#039;)
    {
      alert(&quot;Primary Contact none, hiding the tab&quot;);
      HideTab(&#039;Profile&#039;);
    }
}
else if (crmForm.all.primarycontactid.DataValue[0].name == &#039;maxjerin&#039;)
{
    alert(&quot;Primary Contact p f, unhiding the tab&quot;);
    UnHideTab(&#039;Profile&#039;);
    //replace &quot;Administration&quot; with your tab name
}
else  if (crmForm.all.primarycontactid.DataValue[0].name != &#039;maxjerin&#039;)
{
    var strTabStatus = TabStatus(&#039;Profile&#039;);
    if (strTabStatus == &#039;&#039; )
    {
      alert(&quot;Primary Contact other than maxjerin, Hiding the tab&quot;);
      HideTab(&#039;Profile&#039;);
    }
}




function HideTab (tabText)
{
 var tab = FindTab(tabText);
 if (tab)
 {
  tab.style.display = &quot;none&quot;;
 }
}

function UnHideTab (tabText)
{
 var tab = FindTab(tabText);
 if (tab)
 {
  tab.style.display = &quot;&quot;;
 }
}




function FindTab(tabText)
{
 var tabBar = document.getElementById(&quot;crmTabBar&quot;);
 if (tabBar)
 {
  var tabs = tabBar.childNodes;  
  
  for (var i = 0, len = tabs.length; i &lt; len; i++)
  {
   var currentTab = tabs[i];
   if (currentTab.innerText === tabText)
   {
    return currentTab;
   }
  }
 }
}


function TabStatus(tabText)
{
 var tabBar = document.getElementById(&quot;crmTabBar&quot;);
 if (tabBar)
 {
  var tabs = tabBar.childNodes;  
  
  for (var i = 0, len = tabs.length; i &lt; len; i++)
  {
   var currentTab = tabs[i];
   if (currentTab.innerText === tabText)
  {
   if (currentTab.style.display  == &#039;none&#039;)
   {
    alert(&quot;tab already hidden, TAB NAME:  &quot; + currentTab.innerText  );
    return &quot;none&quot;;
   }
   else
   {
    alert(&quot;tab is visible, TAB NAME:  &quot; + currentTab.innerText );
    return &quot;&quot;;
    }
   }
  }
 }
}

Cheers,
maxjerin</description>
		<content:encoded><![CDATA[<p>Here is the code that I used to HIDE/UNHIDE a tab when I wanted to show it for only one particular user and hide for others. The code includes some alert messages just for debugging purpose which you might find useful to understand the code. You may remove them once done.</p>
<p>This section goes into the onChange section of the Primary Contact lookup field</p>
<p>if (crmForm.all.primarycontactid.DataValue == null )<br />
{<br />
    var strTabStatus = TabStatus(&#8216;Profile&#8217;);<br />
    if ( strTabStatus == &#8221;)<br />
    {<br />
      alert(&#8220;Primary Contact none, hiding the tab&#8221;);<br />
      HideTab(&#8216;Profile&#8217;);<br />
    }<br />
}<br />
else if (crmForm.all.primarycontactid.DataValue[0].name == &#8216;maxjerin&#8217;)<br />
{<br />
    alert(&#8220;Primary Contact p f, unhiding the tab&#8221;);<br />
    UnHideTab(&#8216;Profile&#8217;);<br />
    //replace &#8220;Administration&#8221; with your tab name<br />
}<br />
else  if (crmForm.all.primarycontactid.DataValue[0].name != &#8216;maxjerin&#8217;)<br />
{<br />
    var strTabStatus = TabStatus(&#8216;Profile&#8217;);<br />
    if (strTabStatus == &#8221; )<br />
    {<br />
      alert(&#8220;Primary Contact other than maxjerin, Hiding the tab&#8221;);<br />
      HideTab(&#8216;Profile&#8217;);<br />
    }<br />
}</p>
<p>function HideTab (tabText)<br />
{<br />
 var tab = FindTab(tabText);<br />
 if (tab)<br />
 {<br />
  tab.style.display = &#8220;none&#8221;;<br />
 }<br />
}</p>
<p>function UnHideTab (tabText)<br />
{<br />
 var tab = FindTab(tabText);<br />
 if (tab)<br />
 {<br />
  tab.style.display = &#8220;&#8221;;<br />
 }<br />
}</p>
<p>function FindTab(tabText)<br />
{<br />
 var tabBar = document.getElementById(&#8220;crmTabBar&#8221;);<br />
 if (tabBar)<br />
 {<br />
  var tabs = tabBar.childNodes;  </p>
<p>  for (var i = 0, len = tabs.length; i &lt; len; i++)<br />
  {<br />
   var currentTab = tabs[i];<br />
   if (currentTab.innerText === tabText)<br />
   {<br />
    return currentTab;<br />
   }<br />
  }<br />
 }<br />
}</p>
<p>function TabStatus(tabText)<br />
{<br />
 var tabBar = document.getElementById(&#8220;crmTabBar&#8221;);<br />
 if (tabBar)<br />
 {<br />
  var tabs = tabBar.childNodes;  </p>
<p>  for (var i = 0, len = tabs.length; i &lt; len; i++)<br />
  {<br />
   var currentTab = tabs[i];<br />
   if (currentTab.innerText === tabText)<br />
  {<br />
   if (currentTab.style.display  == &#8216;none&#8217;)<br />
   {<br />
    alert(&#8220;tab already hidden, TAB NAME:  &#8221; + currentTab.innerText  );<br />
    return &#8220;none&#8221;;<br />
   }<br />
   else<br />
   {<br />
    alert(&#8220;tab is visible, TAB NAME:  &#8221; + currentTab.innerText );<br />
    return &#8220;&#8221;;<br />
    }<br />
   }<br />
  }<br />
 }<br />
}</p>
<p>Cheers,<br />
maxjerin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maxjerin</title>
		<link>http://www.mohamedibrahim.net/blog/2010/03/03/hide-tab-in-any-entity-form-in-microsoft-dynamics-crm-4-using-javascript-in-onload-event-of-the-form/comment-page-1/#comment-834</link>
		<dc:creator>maxjerin</dc:creator>
		<pubDate>Wed, 07 Apr 2010 06:52:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.mohamedibrahim.net/blog/?p=177#comment-834</guid>
		<description>After much Googling, I found it

tab.style.display = &quot;&quot;;   //As simple as that</description>
		<content:encoded><![CDATA[<p>After much Googling, I found it</p>
<p>tab.style.display = &#8220;&#8221;;   //As simple as that</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maxjerin</title>
		<link>http://www.mohamedibrahim.net/blog/2010/03/03/hide-tab-in-any-entity-form-in-microsoft-dynamics-crm-4-using-javascript-in-onload-event-of-the-form/comment-page-1/#comment-833</link>
		<dc:creator>maxjerin</dc:creator>
		<pubDate>Wed, 07 Apr 2010 05:51:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.mohamedibrahim.net/blog/?p=177#comment-833</guid>
		<description>Hey Ibrahim,

Could you also give a description on how to reverse the process, I wanted to hide/unhide based on the onChange event of a lookup field</description>
		<content:encoded><![CDATA[<p>Hey Ibrahim,</p>
<p>Could you also give a description on how to reverse the process, I wanted to hide/unhide based on the onChange event of a lookup field</p>
]]></content:encoded>
	</item>
</channel>
</rss>

