Friday, July 18, 2008

Moving a Left Hand Nav item to a TAB in CRM 4.0

First you need to get the ID of the left hand Nav item you want to move. I used IE Develpoer Tool Bar. Or the naming is very straight forward. In this Case I created 2 custom entities. Price002 and Price003. Now the names look better on my screen but it keeps it easy to understand. The parent entity is Price002 and I have a related entity showing up on the left hand nav called Price003. If you did not modify any of the items on the relationship the ID should be nav_new_new_price002_new_price003. I know it looks wierd but when you create the relationship between two "new" custom entities you get new_[entity1]_[entity2].
Now that we have that I created a iframe and called it pa.
Now add the following to your on page load event.

var nav_new_new_price002_new_price003;
nav_new_new_price002_new_price003= document.all.nav_new_new_price002_new_price003;

if (nav_new_new_price002_new_price003!= null)
{
nav_new_new_price002_new_price003.style.display="none"
a = "/"+ORG_UNIQUE_NAME + "/userdefined/areas.aspx?oId=" + crmForm.ObjectId + "&oType="+crmForm.ObjectTypeCode +"&security="+document.crmFormSubmit.crmFormSubmitSecurity.value+"&tabSet=new_new_price002_new_price003";
if (crmForm.FormType == 2 || crmForm.FormType == 3 || crmForm.FormType == 4)
{
document.all.IFRAME_pa.src=a;
}
}

No comments: