Inetium Blogs
Inetium Blog Web Site

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.


Posted Jun 25 2007, 02:34 PM by Jeremy Winchell

Comments

Andrew Whiteside wrote re: Hiding Unwanted Navigation In CRM
on 08-08-2007 9:37 PM

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

Mark Chaffee wrote re: Hiding Unwanted Navigation In CRM
on 08-28-2007 10:29 AM
Plc wrote re: Hiding Unwanted Navigation In CRM
on 09-13-2007 10:24 AM

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";

Jaber wrote re: Hiding Unwanted Navigation In CRM
on 09-17-2007 9:23 PM

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

Jaber wrote re: Hiding Unwanted Navigation In CRM
on 09-17-2007 9:27 PM

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

Vito wrote re: Hiding Unwanted Navigation In CRM
on 10-02-2007 4:22 AM

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

Jeremy Winchell wrote re: Hiding Unwanted Navigation In CRM
on 10-02-2007 9:05 PM

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.

Jeremy Winchell wrote re: Hiding Unwanted Navigation In CRM
on 10-02-2007 9:07 PM

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

uri wrote re: Hiding Unwanted Navigation In CRM
on 02-06-2008 3:23 AM

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

Ani wrote re: Hiding Unwanted Navigation In CRM
on 07-02-2008 11:44 PM

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

Mcdxrsqz wrote re: Hiding Unwanted Navigation In CRM
on 07-31-2008 4:46 PM

good post man thx

Ano wrote re: Hiding Unwanted Navigation In CRM
on 08-19-2008 8:08 AM

Hi

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

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Inetium, LLC. Disclaimer