Dynamics CRM 4.0 - Show/Hide Left Menu Navigation Options

,
The below code is for Showing/Hiding Navigation menu items on the left hand side of any forms within Dynamics CRM 4.0. The code below includes setting up a Navigation Options tab to allow you to select which items to show and a control attribute on another tab to show or hide the desired tab (For full instructions Download Full Document)


Post into the OnLoad & OnSave events of the form you wish to effect:




//Hide Or Show Display Options Tab. Note: the tab number is dependent on tab you wish to hid
If (crmForm.all.new_showhidenavtab.DataValue == false)
{
//hide the second tab
crmForm.all.tab5Tab.style.display = "none";
}
else {
//show the second tab
crmForm.all.tab5Tab.style.display = "";
}
//Hide or Show Left Navigation Items
if (crmForm.all.new_moreaddressesnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navAddresses").style.display = "none";
}
else {
//show the second tab
document.getElementById("navAddresses").style.display = "";

}
if (crmForm.all.new_activitiesnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navActivities").style.display = "none";
}
else {
//show the second tab
document.getElementById("navActivities").style.display = "";
}
if (crmForm.all.new_historynavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navActivityHistory").style.display = "none";
}
else {
//show the second tab
document.getElementById("navActivityHistory").style.display = "";
}
if (crmForm.all.new_subaccountsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navSubAct").style.display = "none";
}
else {
//show the second tab
document.getElementById("navSubAct").style.display = "";
}
if (crmForm.all.new_contactsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navContacts").style.display = "none";
}
else {
//show the second tab
document.getElementById("navContacts").style.display = "";
}
if (crmForm.all.new_relationshipsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navRelationships").style.display = "none";
}
else {
//show the second tab
document.getElementById("navRelationships").style.display = "";
}
if (crmForm.all.new_workflowsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navAsyncOperations").style.display = "none";
}
else {
//show the second tab
document.getElementById("navAsyncOperations").style.display = "";
}


Post into the OnChange events of the attributes:





Show/hidenavtab
//Hide Or Show Display Options Tab. Note: the tab number is dependent on tab you wish to hide
if (crmForm.all.new_showhidenavtab.DataValue == false)
{
//hide the second tab
crmForm.all.tab5Tab.style.display = "none";
}

else {
//show the second tab
crmForm.all.tab5Tab.style.display = "";
}

Moreaddressesnavoption
if (crmForm.all.new_moreaddressesnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navAddresses").style.display = "none";
}

else {
//show the second tab
document.getElementById("navAddresses").style.display = "";
}

Activitiesnavoption
if (crmForm.all.new_activitiesnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navActivities").style.display = "none";
}
else {
//show the second tab
document.getElementById("navActivities").style.display = "";
}
Historynavoption
if (crmForm.all.new_historynavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navActivityHistory").style.display = "none";
}

else {
//show the second tab
document.getElementById("navActivityHistory").style.display = "";
}

Sub-Accountsnavoption
if (crmForm.all.new_subaccountsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navSubAct").style.display = "none";
}

else {
//show the second tab
document.getElementById("navSubAct").style.display = "";
}

Contactsnavoption
if (crmForm.all.new_contactsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navContacts").style.display = "none";
}

else {
//show the second tab
document.getElementById("navContacts").style.display = "";
}

Relationshipsnavoption
if (crmForm.all.new_relationshipsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navRelationships").style.display = "none";
}

else {
//show the second tab
document.getElementById("navRelationships").style.display = "";
}

Workflowsnavoption
if (crmForm.all.new_workflowsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navAsyncOperations").style.display = "none";
}

else {
//show the second tab
document.getElementById("navAsyncOperations").style.display = "";
}


0 comments:

Post a Comment