Tuesday, October 16, 2007

How to hide CRM 3.0 menu items

A requirement for one of my clients required me to hide the" save and new" from an entity.

This is very simple to do, essentially the CRM developers named these buttons with a static name that can be accessed within any javascript event.

here is the reference to the most common buttons:


Save = "_MBcrmFormSave"
Save and Close = "_MBcrmFormSaveAndClose"
Save and New = "_MBcrmFormSubmitCrmForm59truetruefalse"
Print = "_MBcrmFormPrint"
Save as completed = "_MBSaveAsCompleted"


to hide the button simply call the following function:

document.getElementById('[name of the button]').Style.Display='None' or 'Inline';

Setting the Style.Display to 'None' will hide the button.

Setting the Style.Display to 'Inline'will Show the button.

*** Please make sure that the menu item actually exists, use this statement for the test:

var mnuItem = document.getElementById('[name of the button]');
if( mnuItem != null)

{
//hide or show here
}

***

I would appreciate if anyone knows the ID name for other buttons to post it as a comment, if you do so i will append it to the post and of course credit you for it.


Have a great Day

Oshri Cohen

Labels: , , , , ,

Links to this post:

Create a Link

<< Home