Views:

Overview

In this article, we demonstrate how to use North52 Quick Ribbon to open a custom page in a Microsoft Dynamics 365 model-driven app. For a detailed example please see xRM Formula #283 - Model-Driven App Custom Page Dialogs with Decision Table Logic.

North52 BPA Solution 

The North52 BPA solution works like this:

  • An App is created with a standard view of Accounts
  • The Main Grid command bar is customized and a new button is added with the North52 Quick Ribbon JavaScript library 

Button Configuration

  • Open your App
  • Click on the ellipsis (...) beside the Account entity and select Edit command bar 
  • Select the Main grid 
  • Add a new Command
    • Set the Label - In this example, we use Custom Page Demo
    • Set an icon if desired
    • Use Run JavaScript for the Action
    • The Library will be north52_quick_ribbon.js 
    • N52QuickRibbon.OpenCustomPage will be the function name
    • There are 6 required Parameters that need to be set in this order:
      • Custom page name
      • Page Title
      • The Selected Items
      • The Start Screen (can be blank)
        • Can be extracted in the Custom Page to determine the Start Screen for the Custom page
      • The Selected Control (can be blank)
        • Enter SelectedControl to refresh this control when closing a dialog)
      • Navigation Options (can be blank)
    • In this example, we are setting the following parameters:
      • n52demo_custompagetest_1c8e1
      • North52 Dialog
      • SelectedControlSelectedItemIds
      • Screen_ProcessAccounts
      • SelectedControl
      • 2,1,50,%,70,%
  • Save and Publish the App

Access the Selected Items and Start Screen in your Custom Page

To access the GUIDs of the Selected Items in your custom page you can retrieve the details from the Param("entityName") function. The following example shows how to set variables for recordIds and startScreen, and then use the startScreen variable to navigate to the desired start screen. 

Set(pageParams, Param("entityName"));
Set(recordIds,First(Split(pageParams,"|")).Result);
Set(startScreen,Last(Split(pageParams,"|")).Result);
Switch(startScreen, 
    "Screen_ProcessAccounts", Navigate(Screen_CompareAccounts),
    "Screen_ProcessOpportunities", Navigate(Screen_ProcessOpportunities),
    Navigate(Screen_Error,None,{ErrorMessage: "The Start Screen has not been specified."})
);

If you do not pass a start screen parameter in the command, you can simply access the selected item GUIDs using the Param("entityName") function.