Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

PowerObjects Blog 

for Microsoft Business Applications


Add Custom Rules for Ribbon Buttons Using JavaScript in CRM 2011

Post Author: Joe D365 |

In Microsoft Dynamics CRM 2011, you have the option to customize the ribbon and create rules for any buttons that you add. If you don't want to use out-of-the-box rules, you can add your own custom rule using JavaScript.

After you create a custom ribbon button and add a rule, you can define the rule as a custom rule. Here's how:

  1. First make sure that the entity with the ribbon button is in the solution that you want to work with.

    Custom Rules for Ribbon Buttons in CRM 2011

  2. Now create a JavaScript file to make the custom rule. The code will return true or false to answer the condition.

  3. Export the solution and mark the customization when you export it.


  4. Now you can extract the customization.xml file that exist inside the solution.

  5. Modify the code as follows to enable the rule in the CommandDefinition. Point to the Id of the rule. The rule itself is under RuleDefinitions.

    image_update_custom_rules

  6. Finally, copy the file and reimport it.

There you have it—a simple guide to using JavaScript to create custom rules for ribbon buttons in CRM 2011!

If you want more information on customizing the ribbon in Microsoft Dynamics CRM 2011, check out our blogs on how to hide a ribbon button or our general guide on ribbon customization.

Happy CRM'ing!

Joe CRM
By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

PowerObjects Recommends