I was having a requirement to generate a dynamic ribbon menu under a button i.e. Flyout button menu sections, Here I want to share the steps for achieving this dynamic menu section. I have used Ribbon workbench and some JS scripts.

We need to achieve the highlighted menu dynamically.

Here in workbench, we need to add a flyout button

In the command action, call JS function “populateEnrollmentFlyout” that is responsible for adding the menu sections definition in XML. 

Add another command “programClicked” that will be triggered when the user clicks on the menu section button.

Below are the two JS functions used in the above commands.

function populateEnrollmentFlyout(commandProperties) {
    var programsRibbonXml = "";
    var command="msd.lead.Command.ProgramClicked";
 
    var programs = retrieveMultiple('msd_programs', "?$select=msd_programid,msd_name"); 
    programsRibbonXml +=""
    if (programs != null) {      
        for (var i = 0; i < programs.length; i++) {           
                var Name = programs[i].msd_name;
                var Value = programs[i].msd_programid;                
                programsRibbonXml+="" 
        }
    }
    programsRibbonXml +="";
    commandProperties["PopulationXML"] = '' + programsRibbonXml + "";
}

function programClicked(commandProperties) {
    alert ("program with id "+commandProperties.SourceControlId +" selected.");
}

Hope it will help!

You can find my new blog for adding flyout menu buttons in UCI: 

Dynamically Populating Ribbon Flyout Menu in Unified Interface

siddiquemahsud
Author: siddiquemahsud

5 responses to “Dynamically Populating Ribbon Flyout Menu”

  1.  Avatar

    Did you test it in the UCI and in the CDS-UCI. For me it not working!

  2.  Avatar

    Mate – Didn't tested in UCI, its in working for me in CRM 2016 on – premises

  3.  Avatar

    Update and added a new post for dynamically Populating Ribbon Flyout Menu in Unified Interfacehttps://siddiquemahsud.blogspot.com/2019/09/dynamically-populating-ribbon-flyout.htmlThanks

  4.  Avatar

    Not working at all

  5.  Avatar

    i have tried this is on Fly Out and its not working. it is just showing Loading… for Menu section.

Leave a Reply

Your email address will not be published. Required fields are marked *