After you create a custom ribbon button and add a rule, you can define the rule as a custom rule. Here’s how:
First make sure that the entity with the ribbon button is in the solution that you want to work with.
Export the solution and mark the customization when you export it.
Now you can extract the customization.xml file that exist inside the solution.
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.
- Finally, copy the file and reimport it.