Tuesday, August 19, 2008

Hiding Lookup Buttons

Generally speaking, Microsoft CRM has two types of buttons or families. The first family is directly related to the user security roles e.g. "New" and "Save". The other is not related to a certain supported mechanism and can not be hidden using supported means. Never the less if you have such requirement you can always use unsupported measures. Here is an example of how to hide the lookup "New" and "Properties" buttons using both supported and unsupported routes.

Supported: The New button can be disabled by reducing the create rights on the user role. The button is still shown but is grayed out and the user can not use it. The Properties button can not be hidden in any supported way.

Unsupported: Use the following code inside the crmForm onload event.

function OnCrmPageLoad()
var aLookup = crmForm.all.<LookupId>;
aLookup.AddParam( “ShowNewButton” , “0” );
aLookup.AddParam( “ShowPropButton” , “0” );
aLookup.showproperty = false;


1 comment:

aarch said...

Brilliant :-) thanks adi