locked
CRM 2011: Ribbon is disabled with Navigation Link pages RRS feed

  • Question

  • Hi,

    I encountered a problem when using Navigation Link to custom web resource file. Entity ribbon goes to disabled state when I click Navigation Link that opens my custom .htm file. I assume that this happens, because it's not an entity and it's not including needed code for the ribbon.

    Is there a workaround so it would be possible to use the normal ribbon for custom web resource pages?

    It would be nice to have the same user interface in use without creating new button menu inside to the custom pages.

    Thanks in advance.

    Monday, August 22, 2011 7:48 AM

Answers

  • I managed to do a workaround for this problem before, but I did not remember to write it here.

    What I did is I made a new entity. Then I made relationship from that to Account entity, so I could get new entity link to Account navigation panel.

    After this starts the tricky part. I made JavaScript function to Account form load, so it binds click event to that new entity button. Click event hides default view iframe and puts my custom .html iframe there instead. Then I got the ribbon working through that dummy entity.

    I can explain this better if someone else needs this solution.

    • Marked as answer by Kimmo Koski Thursday, September 15, 2011 12:30 PM
    Thursday, September 15, 2011 12:30 PM

All replies

  • Hi,

    The ribbon buttons has different enable and display rules, if you will export the Ribbon customization file via the RibbonExportXML tool available with the SDK then you will see that almost entity every ribbon have assosiated Display and Enable rules. When you will navigate to the custom page then these rules validations will be failed and ribbon buttons will be disabled but i am sure that custom ribbon buttons not dependent on form rules will work. You can see  Deactivate button rules as an example:

     

    <EnableRules>
    
              <EnableRule Id="Mscrm.VisualizationPaneNotMaximized" />
    
              <EnableRule Id="Mscrm.SelectionCountAtLeastOne" />
    
            </EnableRules>
    
            <DisplayRules>
    
              <DisplayRule Id="Mscrm.CanWriteSelected" />
    
              <DisplayRule Id="Mscrm.SelectedEntityHasStatecode" />
    
            </DisplayRules>
    

    the CanWriteSelected display rule requires entity privelege rule. 

     <DisplayRule Id="Mscrm.CanWriteSelected">

              <EntityPrivilegeRule AppliesTo="SelectedEntity" PrivilegeType="Write" PrivilegeDepth="Basic" />

            </DisplayRule>

     


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Monday, August 22, 2011 7:59 AM
  • Thanks for the answer, but I think my problem description misleads you a little bit.

    When you add Navigation Link for example to Account entity navigation and configure it to open .htm page from web resource. Then you open any account form you can see the new link at the navigation menu. When you click that link it opens .htm page like it should, but then it also disables current ribbon. Ribbon that shows in disabled state is the previous ribbon that worked before navigation link click.

    So it seems that ribbon wont work because the .htm page don't include any configuration for the ribbon to work. Is there a workaround to get a working ribbon for navigation link pages through application ribbon file for example etc.?

    Monday, August 22, 2011 9:13 AM
  • Hi,

    There is no out of the box option available to enable the ribbon buttons, instead of enabling the ribbon by modifying Ribbon element via DOM i would suggest you to add the new Tab at the bottom of the form and display the Web Resource in the tab, you can change the Tab height as per required and Uncheck the option Expand this default tab by default so the Htm file will load on expanding the tab by clicking on to the Tab Navigation link.


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Monday, August 22, 2011 9:33 AM
  • I managed to do a workaround for this problem before, but I did not remember to write it here.

    What I did is I made a new entity. Then I made relationship from that to Account entity, so I could get new entity link to Account navigation panel.

    After this starts the tricky part. I made JavaScript function to Account form load, so it binds click event to that new entity button. Click event hides default view iframe and puts my custom .html iframe there instead. Then I got the ribbon working through that dummy entity.

    I can explain this better if someone else needs this solution.

    • Marked as answer by Kimmo Koski Thursday, September 15, 2011 12:30 PM
    Thursday, September 15, 2011 12:30 PM
  • Hi Koskikimmo,

    I followed the same procedure.But still the ribbon is disabled.

    Can u pls provide a detailed explanation on what you did exactly?

    Thanks in advance.

    Cheers....!

    Tuesday, September 27, 2011 4:24 PM
  • Hi Koskikimmo,

    I followed the same procedure.But still the ribbon is disabled.

    Can u pls provide a detailed explanation on what you did exactly?

    Thanks in advance.

    Cheers....!

    Hi

    If you have any other solution, please let me know. Thanks

    Cheers

    Govind

    Tuesday, November 20, 2012 11:34 AM
  • I have a javascript hack to enable the form's main ribbon when a navigation link is clicked. This does not cover wiring up your web resource to the ribbon; there may be issues with that, especially if your navigation link goes to a custom page on a different domain.

    This is unsupported, so it may break on updates from Microsoft. 

    The idea is to hijack the navigation tab's click event the first time it's clicked, simulate the click of a tab on the main form, then click the nav tab as before. This makes use of what appears to be a bug in the ribbon, where the ribbon is disabled the first time the nav tab is clicked, but if you click on a tab in the main form and then click the nav tab again, the ribbon is now enabled.

    You'll need to add jquery as a web resource to the form and place this code in the form's load event.

    You'll need to use developer tools to find 1) the id of  a tab in the main form (I named mine mainFormTab in this example) and 2) the id of your navigation link (I named mine navLink in this example)

        $(document).ready(function () {
            var ribbonNeedsRefresh = true; // only do this once
            // add nav items to this selector
            $('#navLink').click(function () {    // hijack the nav tab's click function
                if (!ribbonNeedsRefresh) return; // only do this once
                $('#mainFormTab').click();       // click a tab on the main form to enable the ribbon
                ribbonNeedsRefresh = false;      // we don't need to do this again
                $(this).click();                 // do the regular click event
            });
        });

    This is a very late post so I hope it helps someone.


    Monday, November 10, 2014 11:08 PM