Views:

This is a follow on article from Execute Formula - Button on Form.

In this article we will attach a ribbon button to a list view on Dynamics 365.

Note: After version 1.0.0.530 North52 supports calling other formula types like this, but only ClientSide - Calculation will allow you to return a response to the calling screen.

Step 1: Configure the N52 Formula

The formula below will clone the existing Quote:

Step 2: Add the Quick Ribbon to the entity using Ribbon Workbench

  • Open Ribbon Workbench and connect to your instance of Dynamics 365
  • We have created a solution with just the Quote entity added to it:

Command

  • Configure a Command by clicking on the + icon. We change the name to new.quote.N52.ListViewCloneCommand
     

  • We will be add 4 JavaScript Actions to this button:
     
  • The first three will be used to load N52 support files on the button and the fourth will be used to execute the formula
    • $webresource:north52_/javascript/n52.rest
    • $webresource:north52_/javascript/n52.json2 
    • $webresource:north52_/javascript/n52.clientside
  • The function name should be set to isNaN
     
  • The fourth Javascript Action will use $webresource:north52_quick_ribbon.js and the function should be set to N52QuickRibbon.ExecuteFormulaOnView
     
  • Unlike the form, we will be passing in 4 parameters instead of just one.
    • Crm Parameter: SelectedControlSelectedItemsIds 
    • Crm Parameter: SelectedEntityTypeName  
    • Crm Parameter: UserLcid   
    • String Parameter: shortcode of the formula

Button

  • Drag a button onto the form. We set the ID to be new.quote.N52.ListViewCloneButton and name it Clone Quotes
  • Set the Command to be the newly created command. For this example, we will use the create new order icon:
    • /_imgs/SFA/CreateOrder_16.png
    • /_imgs/SFA/CreateOrder_32.png
  • Publish the Solution

List of Quotes in Dynamics 365

  • In the screen capture below, there are 8 quote records. We select them all and then click on the Clone Quotes ribbon button

  • When we refresh the list we can see that all 8 quotes have been duplicated:

Confirmation Dialogs

It is possible to include a confirmation dialog in a Quick Ribbon on a list view.
  • To do this you would simply add another string parameter to the Quick Ribbon containing the text you want to display
  • In the example below, before executing the formula GFW, we will ask the user if they are sure that they want to charge this customer:
  • This additional string parameter has been added to the button: Close & Charge
  • A pop up dialog will ask me to confirm that I want to do this action:
  • Clicking OK will execute the formula. If Cancel is clicked then the formula will not be executed.