Hiding Unwanted Navigation In CRM

Have you ever wanted to hide certain Navigational items that exist CRM forms?  One request we get from time to time is whether or not it is possible to hide the Sub-Contacts menu item, see the image below, from the Contact Form.  In fact, this is relatively easy to do.  All you need is a basic understanding of HTML and JavaScript.

To Get Started, Follow the Instructions Below

Find the ID of the Sub-Contacts Section:

  1. Open A Contact in Microsoft CRM 
  2. With the Contact Open, Press Ctrl + N to open the Contact in a new window
  3. In Internet Explorer Click View -> Source
  4. When the HTML opens in Notepad do a search for  Sub-Contacts, results are in the image below
  5. Just before the highlighted text you will see:  id="navSubConts", write down stuff between the "" signs.Contact Form HTML

Add the Javascript Below to the OnLoad Event of the Contact Form:

  1. Open CRM in the Web Client
  2. Click Settings -> Customization -> Customize Entities
  3. Double-Click the Contact Entity
  4. Click Forms & Views in the left-hand pane
  5. When the list of Forms & Views appear in the right-side, double-click Form
  6. In the right-hand pane, Click Form Properties
  7. Click OnLoad and Click Edit
  8. Paste the following Javascript in the box:
    1. document.getElementById("navSubConts").style.display = "none";
  9. Check the Enable Event checkbox


  10. Click Save & Close twice and then click Publish

Test The Script:

1. Open up a Contact in CRM, if you're script is working correctly the Sub-Contacts menu option should now be gone, just like the image below:

Hidden Sub-Contacts Record

You can use this same technique to hide other menu items in not only the Contact form within CRM but in any of the other CRM Forms as well.  Now you have more control over what the users can and can't do in CRM.  The main key to getting this to work is finding the right ID value in the HTML code.  I've noticed that most, if not all of the Navigation is stored with <div></div> tags.  If you can find the correct ID, then the rest is pretty easy.

Published 06-25-2007 2:34 PM by Jeremy Winchell

Comments

# re: Hiding Unwanted Navigation In CRM

Wednesday, August 08, 2007 9:37 PM by Andrew Whiteside

You are the man!! I just had a request from a client to remove the Activites and History from the menus, for some custom enties. This technique works perfectly. I am currently working on customising a CRM system, and your blog looks to be very helpful.

Keep up the good work, it is appreciated :)

Cheers

# re: Hiding Unwanted Navigation In CRM

Tuesday, August 28, 2007 10:29 AM by Mark Chaffee

Jeremy,

To find the source try using IE Dev Toolbar.  http://blogs.msdn.com/midatlanticcrm/archive/2006/01/02/Dynamically-Showing-or-Hiding-Tabs-in-Microsoft-CRM-3.aspx>

# re: Hiding Unwanted Navigation In CRM

Thursday, September 13, 2007 10:24 AM by Plc

Jeremy,

good one, how do I dynamically change the names of those items depending on the entity they appear on. i tried this on the onload event of each form it doesnt work.

document.getElementById("nav_opportunity_new_opportunitycandidates")_c.innerText = "Other name";

# re: Hiding Unwanted Navigation In CRM

Monday, September 17, 2007 9:23 PM by Jaber

Hi Plc

I just passed that hurdle, so here is the mantra means code:

var navSubContacts = document.all.navSubConts;

navSubContacts.getElementsByTagName("nobr")[0].innerHTML = "your new name";

If you put this code on the onLoad event of entity Contact then it changes the name

of the entity Sub-Contacts in the LEft Navigation bar to "your new name".

You can put any name you want in place of "your new name".

Note:- if you  preview the form may be it give you an error but donot worry about that. Just publsh it you and its working.

regards

Jaber

# re: Hiding Unwanted Navigation In CRM

Monday, September 17, 2007 9:27 PM by Jaber

Hi Jeremy there is another way which is a supported way by Microsoft.

You can do it by Security roles.

Just donot give access to the entities which you donot want the user to see.

regards

Jaber

# re: Hiding Unwanted Navigation In CRM

Tuesday, October 02, 2007 4:22 AM by Vito

Is it possible to open the detail window of entity 'contact' with a different subarea opened by default, for example history sub area?

# re: Hiding Unwanted Navigation In CRM

Tuesday, October 02, 2007 9:05 PM by Jeremy Winchell

Jaber,

The security role option works very well as long as you want to hide the Entity completely.  In this example though, the only way to get rid of Sub-Contacts through security is to remove access to Contacts.  There isn't a way to get rid of the Sub-Contacts menu option and still have access to Contacts.

If you know of a way of manipulating this via security roles that would be great to know.

Thanks for the posts, very helpful and informative for all.

# re: Hiding Unwanted Navigation In CRM

Tuesday, October 02, 2007 9:07 PM by Jeremy Winchell

Vito,

That is a very good question.  You may be able to trigger the OnClick() event of the menu item in the OnLoad() event of the form to have it update the Grid with a different sub_area.

This will be something to research.  If I find a solution for this I'll be sure to post it here.

Thanks,

Jeremy

# re: Hiding Unwanted Navigation In CRM

Wednesday, February 06, 2008 3:23 AM by uri

How can i take control to menu item with a javascript function?

crmForm.all._MInameitem.onclick = myfunction;

This is correct only for a buttons, ("_MBnamebutton") but not for items,

thanks in advance

uri

# re: Hiding Unwanted Navigation In CRM

Wednesday, July 02, 2008 11:44 PM by Ani

The hiding concept helped me so much thankyou,i am working with crm 4.0 and for a user with marketing professional role i have given access only to marketing rest sales and service i removed all the access but still he is able to sales and service tab with core records can u help how to over come this ,the marketing professional must see marketing,workplace tabs only under navigation

Thanks in Advance ,

Ani

# re: Hiding Unwanted Navigation In CRM

Thursday, July 31, 2008 4:46 PM by Mcdxrsqz

good post man thx

# re: Hiding Unwanted Navigation In CRM

Tuesday, August 19, 2008 8:08 AM by Ano

Hi

Is it possible to hide the "Add Existing ...." from the Grid in the iFrame?

# re: Hiding Unwanted Navigation In CRM

Wednesday, September 03, 2008 6:56 AM by jonn

gopoz

# re: Hiding Unwanted Navigation In CRM

Wednesday, September 03, 2008 7:11 AM by jonn

grererret

# re: Hiding Unwanted Navigation In CRM

Friday, September 05, 2008 5:07 AM by Tevinder

is it possible to hide Custome Entities from the File Menu -> More.. . I don't want to show anything there.

# re: Hiding Unwanted Navigation In CRM

Wednesday, September 10, 2008 12:50 AM by dirtbill

Very interesting tale

# re: Hiding Unwanted Navigation In CRM

Saturday, October 11, 2008 4:39 PM by Dodd

Do you know of a way to hide the entire Left Nav Bar for an entity?? I'm trying to build alerts using a custom CRM Entity Form. I'm using WF to build the message in the form, and I'm using JScript to open the custom CRM record when necessary, but I want it to be stripped of the entire Left Nav Bar. Any ideas?

# re: Hiding Unwanted Navigation In CRM

Wednesday, October 22, 2008 7:27 PM by Jeremy Winchell

Ano,

I posted a blog post a few weeks ago about how you can hide the Add Existing button from within a CRM Grid.  You can find it using the link below:

blogs.inetium.com/.../hiding-the-add-existing-button-in-a-crm-4-0-grid.aspx

Jeremy

# re: Hiding Unwanted Navigation In CRM

Wednesday, October 22, 2008 7:29 PM by Jeremy Winchell

Dodd,

You can hide the entry from the NavBar on the left.  You will want to open the page in a normal IE window so you can view the source.  Once the source code is open search for the label of your entity.  From there you should be able to find the ID of that item.

Then you can use:

document.getElementById("<name>").style.display = "none";

# re: Hiding Unwanted Navigation In CRM

Wednesday, October 22, 2008 7:29 PM by Jeremy Winchell

Dodd,

You can hide the entry from the NavBar on the left.  You will want to open the page in a normal IE window so you can view the source.  Once the source code is open search for the label of your entity.  From there you should be able to find the ID of that item.

Then you can use:

document.getElementById("<name>").style.display = "none";

Thanks,

Jeremy

# Hiding and Changing Left Navigation Items in CRM 4.0 Entity Screens &laquo; Sivavadavalli&#8217;s Weblog

Pingback from  Hiding and Changing Left Navigation Items in CRM 4.0 Entity Screens « Sivavadavalli’s Weblog

# re: Hiding Unwanted Navigation In CRM

Monday, November 24, 2008 4:30 AM by Pk

Am I incredibly stupid or what? My code is now as follows (found "navSubConts" by viewing source):

document.getElementById("navSubConts").style.display = "none";

I just keep getting an "Object required" error...please help!

# re: Hiding Unwanted Navigation In CRM

Tuesday, February 17, 2009 4:13 AM by Owen

try using ' instead of ". should work fine

# re: Hiding Unwanted Navigation In CRM

Tuesday, February 24, 2009 7:23 PM by NK

Once I removed unwanted navItems from form Nav pane -- how do I remove the areas (such as Marketing, Sales, Services) that i don't need anymore?

thanks!!!

N

# re: Hiding Unwanted Navigation In CRM

Thursday, March 05, 2009 7:20 PM by Jeremy Winchell

NK,

The only way to remove the Area's along the left hand side is through the SiteMap.  You can just comment out the XML in the SiteMap for the Area's that you don't want.

Just make sure you have a backup of your SiteMap.

Jeremy

# re: Hiding Unwanted Navigation In CRM

Wednesday, March 11, 2009 11:06 AM by Marc-Andre

By the way you can hide a navbar item by editing the relationship details (given it's driven by a relationship). Sub-contacts IS a relationship. However, if you want to hide History or Activities, I like the script approach.

# re: Hiding Unwanted Navigation In CRM

Thursday, March 12, 2009 11:11 AM by CRMNEWBIE

I keep getting the error "Object Required" onload 'Case' form. I have the below code in my onLoad().

document.getElementById('_MIresolve').style.display='none' ;

Please Advice!!

# re: Hiding Unwanted Navigation In CRM

Friday, March 13, 2009 5:50 AM by Joop Stringer

Getting the error "Object Required" onload 'Case'  comes from the fact that on a NEW record this is probably not available. Check the CRM form type to see if it is new or update

# re: Hiding Unwanted Navigation In CRM

Sunday, March 15, 2009 2:25 AM by Ashraf

Dear Jeremy Winchell,

I found "Hiding Unwanted Navigation In CRM" solution most easy way. I did this for one of my custom entity and it worked for me but at the same time. The same solution does'nt work for another custom entity. Could you please tell me what could be the issue?

Thanks and Regards,

Ashraf Ansari

# re: Hiding Unwanted Navigation In CRM

Sunday, March 15, 2009 12:47 PM by Jeremy Winchell

Marc-Andre,

Yes you can hide the left-menu items using the relationships section of the parent entity.  This however, is only a feature of CRM 4.0.  In CRM 3.0 you didn't have this option.  At the time this post was published CRM 4.0 wasn't out yet so this feature wasn't available.

Thanks for pointing this out though.  CRM 4.0 makes life a lot easier from this standpoint.

Jeremy

# re: Hiding Unwanted Navigation In CRM

Sunday, March 15, 2009 12:50 PM by Jeremy Winchell

CRMNEWBIE,

It looks like you are trying to hide the "Resolve" menu option that you find in More Actions inside a Case.  Joop is most likely correct in that the specific menu item is not rendered in the Create form.

To add a check to see if the create form or update form is being rendered you can add the following:

if(crmForm.FormType == 1)

{

  //A FormType of 1 means the Create form is being loaded.  You'll want to verify that the item you want to hide exists when this form is rendered.

}

else

{

     if(crmForm.FormType == 2)

     {

          //This is the Update form

          //Add your code to hide additional buttons that are only available during the Update process.

      }

}

Jeremy

# re: Hiding Unwanted Navigation In CRM

Sunday, March 15, 2009 12:52 PM by Jeremy Winchell

Ashraf,

Is this CRM 3.0 or 4.0?  If it's CRM 4.0 I would recommend using the OOB functionality of relationships to hide the entity.

If you post your script and the name of the entity as it appears in the HTML for the Form I'd be glad to take a look.

Jeremy

# re: Hiding Unwanted Navigation In CRM

Monday, March 16, 2009 8:19 AM by Ashraf

Hi Jeremy Winchell,

I am working with CRM 4.0 customization. I solved this as CRM 4.0 provides a simple way of hiding left Navigation using the relationships section of the parent entity.

There is a "Display Option" Dropdownlist which provides the option of "Do not display" the relation in ur left navigation pane.

Thanks,

Ashraf

# Does Workflows in CRM4.0 provides multiplication of two values?

Monday, March 16, 2009 8:22 AM by Ashraf

Hi Jeremy,

Does CRM 4.0's work flows provides calculation based on some fields. I want to calculate value of Attribute "A" and "B" and want to set the result to attribute "C".

Is it possible using workflows or I have to write plug-in to achieve this functionality?

Bye

# re: Hiding Unwanted Navigation In CRM

Monday, March 16, 2009 8:43 PM by Jeremy Winchell

Ashraf,

You could probably do it without having to write a plug-in or custom workflow assembly but the assembly route might be faster.

If attribute C was a number and it was defaulted to 1 or some other value you could set the properties of that field to multiply A, B & C and it would store the values in C.

I haven't tested this but it could work.  For example:

Attribute A =  A Revenue Field

Attribute B =  A numerical field

Attribute C = A revenue or numerical field

A = 50,000

B = .75

C = 1

In workflow when you set the value for C you could:

1.  Click inside of C

2.  Then choose Multiply By A, click Add

3.  Then choose Multiple By B, click Add

4.  Then click Ok

That might do it.

Jeremy