2

I successfully followed the following answer to Add Dropdown Menu to CRM 2011 ribbon and implemented three dynamically loaded FlyoutAnchor buttons with sub menu buttons etc.

Yesterday the sub menu buttons were working fine (click event was fired etc), but after a re-import of the solution with the Ribbon XML etc the sub menu buttons were telling me (in the tooltip) that they are disabled. The exact message is "This button is currently disabled. You may not have selected the item that works with this feature. If you don't have permissions to use this feature, contact your system administrator".

So I reverted back to the previous Ribbon XML, but the sub menu buttons remain disabled. It looks like I hit the same issue as described in the following thread: CRM 2011 Dynamic Ribbon disabled HELP!!. But I already have Rollup 6 installed on my server, so this shouldn't occur.

I already tried resetting IIS and re-importing the solution (multiple times). I also checked/added the <EnableRule Id="Mscrm.Enabled" /> rules etc.

I can't get the sub menu buttons enabled again. What am I doing wrong? Please help me.

Community
  • 1
  • 1
Maarten Docter
  • 1,029
  • 1
  • 13
  • 31

2 Answers2

2

I finally got my sub menu buttons enabled again. It's hard to tell the exact combination of actions that got it to work again, but I will try to document it here as a reference. The proposed solution is to force CRM to update the Ribbon entirely. This can be done by executing the following steps:

  1. Export you solution as a backup.
  2. Unzip a copy of this exported solution somewhere, so you can modify the 'customizations.xml' file to update the RibbonDiffXml of the 'problem' entity.
  3. Replace your <RibbonDiffXml> ...</RibbonDiffXml> with the empty ribbon diff xml, i.e. :

      <RibbonDiffXml>
        <CustomActions />
        <Templates>
            <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
        </Templates>
        <CommandDefinitions />
        <RuleDefinitions>
          <TabDisplayRules />
          <DisplayRules />
          <EnableRules />
        </RuleDefinitions>
        <LocLabels />
      </RibbonDiffXml>
    
  4. Save your change(s).

  5. Re-zip the changed solution, import and publish it.
  6. Re-import your original solution from Step 1 and publish. The ribbon will be re-created.
  7. Your buttons should be enabled again.

Another approach that could be taken, is to use the Ribbon Workbench for Dynamics CRM 2011 (Beta). But be carefull and always make a solution backup because I find the tool still pretty buggy (or maybe my solution was too large). Use the tool to make some ribbon changes (for example: add a new button to your 'problem' entity), re-publish and test. If your sub menu buttons are enabled again, re-import and publish your original backup. The sub menu buttons will probably stay enabled.

So something gets screwed up in CRM internally, and by forcing a re-build of the faulty Ribbon, CRM recovers itself or something...I can't really put my finger on it.

Maarten Docter
  • 1,029
  • 1
  • 13
  • 31
1

I had a similar issue recently. Are your running javascript from the ribbon? If so the ribbon may be disabling your button because it cannot find the javascript function you are calling (I cant find documention to support this belief, the define actions and define javascript pages make no mention of it, it could have just been coincidence in my case). Did you recently update the js file you associate with the ribbon?

BenPatterson1
  • 1,482
  • 12
  • 15
  • Hi Ben, thank you for responding. I tried everything I could think of with the CommandDefinition JavaScript function of the sub menu items. I first used a namespace, something like 'COMPANY.Ribbon.function', created by a self-executing anonymous function. Than I converted that to an object literal construction. And finally I tried a flat function name, like 'function ButtonClicked(){...}', but none of them enables the sub menu items. The strange thing is, that the FlyoutAnchor CommandDefinition JavaScript functions are in the same file, use the same naming construction and DO get triggered. – Maarten Docter Mar 12 '12 at 12:39
  • And if they get triggered, their function can be found, so why can't the sub menu function be found?? – Maarten Docter Mar 12 '12 at 12:41