Enable/Disable out of the box ribbon items

2012-4-5 | apurvghai | Dynamics CRM SDK | C#


Hello Guys, I have come up with an interesting article on enabling/disabling the out of box ribbon items in CRM 2011. This article demonstrates the order entity where I would be disabling the “Create invoice button” based on a condition in jscript. The script returns “false” or “true” value.

Before we get started, here’s the list of requirements with which you need to be familiar:

  • Microsoft Visual Studio 2010 / Notepad ++ (or XML editor)
  • MS CRM SDK 2011
  • Jscript

Walk-through

  • Go to settings > customizations > solutions
  • Click “new” add new solution
  • Provide a valid name, publisher and your version number
  • Save the solution
  • Add the existing “Order” entity.
  • Save & close the dialog
  • Export the solution
  • Unzip the archive and open the customization.xml file
  • Search for “RibbonDiffXML” tag under the order entity
  • Add the following code

  • Save and close the file
  • Zip all the three files Customization.xml, [Content_Types].xml and solution.xml
  • Go to CRM application
  • Go to settings > customizations > customize the system > web resources
  • Click to add “new” web resource, provide a name “new_CustomRule.js”
  • Add the following code

function HideExisting()
{
return false;
}

  • Import the customizations
  • Publish the customizations
  • You can see the changes reflected

You can download the solution below.

Additional Information:

Cheers,
Apurv

Export_Order_1_0_Final.zip


Recent Posts
Getting started with Dynamics 365 CRM SDK in C#
Jan 14, 19 | Dynamics CRM SDK
Using Postman with Dynamics 365 Online and OnPremise
Jan 14, 19 | Dynamics CRM SDK
Getting Started with WebAPI
Dec 28, 18 | Dynamics CRM SDK