Jul 4, 2011

Hiding Menu Items from More Actions

I needed to remove the deactivation option from the Account entity. So I actually have to remove this from two separate menus. One is "More Action" section of the account grid. Other one is "Action" section appeared once account record is opened.

Below link gives a nice way of removing items from Action menu.
Obviously, it can be called onLoad form of the account without any issue.

Removing items from Action menu of the grid is tricky, because we don’t know from where we can call a JavaScript to accomplish our task. After reading and researching I managed to solve this by calling a javaScript from the loading script in below page.

\Microsoft Dynamics CRM\CRMWeb\_root\HomePage.aspx

What is really cool here is, you have typecode in hand for your coding. Since I am interested in account entity, I checked its typecode (i.e. 1) and proceeded with my code. Id of the menu item relevant for deactivation was found through Developer Tools (pressing F12 as usual).

function window.onload()

 if (_currentTypeCode==1)
   if (document.all._MIdoActioncrmGrid1deactivate != null) 
   { document.all._MIdoActioncrmGrid1deactivate.style.display = "none";} 

This seems cool, yet not supported at all.. So please play safely and carefully.

Hope this will help.

No comments:

Post a Comment